From a5957a188273aa192f44ca37dcf963271e39c5fa Mon Sep 17 00:00:00 2001 From: slinkydeveloper Date: Mon, 19 Aug 2024 17:20:12 +0200 Subject: [PATCH 1/5] Add fields for the Side effect retry feature --- dev/restate/service/protocol.proto | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/dev/restate/service/protocol.proto b/dev/restate/service/protocol.proto index 333a36e..6e2a36e 100644 --- a/dev/restate/service/protocol.proto +++ b/dev/restate/service/protocol.proto @@ -47,6 +47,19 @@ message StartMessage { // If this invocation has a key associated (e.g. for objects and workflows), then this key is filled in. Empty otherwise. string key = 6; + + // Retry count since the last stored entry. + // + // Please not this count might not be accurate, as it's not durably stored, + // thus it's susceptible to Restate's crashes/leader election changes. + uint32 retry_count_since_last_stored_entry = 7; + + // Duration since the last stored entry. + // The time is set as duration since UNIX Epoch in milliseconds. + // + // Please note this time might not be accurate, + // and might change depending on which Restate replica executes the request. + uint64 duration_since_last_stored_entry = 8; } // Type: 0x0000 + 1 @@ -90,6 +103,11 @@ message ErrorMessage { optional string related_entry_name = 5; // Entry type. optional uint32 related_entry_type = 6; + + // When to execute the next retry. + // If provided, it will override the default retry policy used by Restate's invoker. + // The time is set as duration since UNIX Epoch in milliseconds. + optional uint64 next_retry_at = 8; } // Type: 0x0000 + 4 From f4e556938ce9be4b9e35331312e38c63a29ed5ed Mon Sep 17 00:00:00 2001 From: slinkydeveloper Date: Thu, 22 Aug 2024 12:03:20 +0200 Subject: [PATCH 2/5] Bump protocol to version 2 --- dev/restate/service/protocol.proto | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dev/restate/service/protocol.proto b/dev/restate/service/protocol.proto index 6e2a36e..9323b58 100644 --- a/dev/restate/service/protocol.proto +++ b/dev/restate/service/protocol.proto @@ -19,6 +19,8 @@ enum ServiceProtocolVersion { SERVICE_PROTOCOL_VERSION_UNSPECIFIED = 0; // initial service protocol version V1 = 1; + // Added ErrorMessage.next_retry_at, StartMessage.retry_count_since_last_stored_entry and StartMessage.duration_since_last_stored_entry + V2 = 2; } // --- Core frames --- From 9f5c6d9477763fc71107301bcd5bddf8b1a981cf Mon Sep 17 00:00:00 2001 From: slinkydeveloper Date: Thu, 22 Aug 2024 14:39:19 +0200 Subject: [PATCH 3/5] better to use duration than time --- dev/restate/service/protocol.proto | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/dev/restate/service/protocol.proto b/dev/restate/service/protocol.proto index 9323b58..2eef84f 100644 --- a/dev/restate/service/protocol.proto +++ b/dev/restate/service/protocol.proto @@ -56,10 +56,9 @@ message StartMessage { // thus it's susceptible to Restate's crashes/leader election changes. uint32 retry_count_since_last_stored_entry = 7; - // Duration since the last stored entry. - // The time is set as duration since UNIX Epoch in milliseconds. + // Duration since the last stored entry, in milliseconds. // - // Please note this time might not be accurate, + // Please note this duration might not be accurate, // and might change depending on which Restate replica executes the request. uint64 duration_since_last_stored_entry = 8; } @@ -106,10 +105,9 @@ message ErrorMessage { // Entry type. optional uint32 related_entry_type = 6; - // When to execute the next retry. - // If provided, it will override the default retry policy used by Restate's invoker. - // The time is set as duration since UNIX Epoch in milliseconds. - optional uint64 next_retry_at = 8; + // Interval before executing the next retry, specified as duration in milliseconds. + // If provided, it will override the default retry policy used by Restate's invoker ONLY for the next retry attempt. + optional uint64 next_retry_interval = 8; } // Type: 0x0000 + 4 From d1bdc947c63c8980171786975d3bc60a59b6d647 Mon Sep 17 00:00:00 2001 From: slinkydeveloper Date: Mon, 26 Aug 2024 14:24:08 +0200 Subject: [PATCH 4/5] Fix comment --- dev/restate/service/protocol.proto | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev/restate/service/protocol.proto b/dev/restate/service/protocol.proto index 2eef84f..56d87c6 100644 --- a/dev/restate/service/protocol.proto +++ b/dev/restate/service/protocol.proto @@ -19,7 +19,8 @@ enum ServiceProtocolVersion { SERVICE_PROTOCOL_VERSION_UNSPECIFIED = 0; // initial service protocol version V1 = 1; - // Added ErrorMessage.next_retry_at, StartMessage.retry_count_since_last_stored_entry and StartMessage.duration_since_last_stored_entry + // Added + // * Entry retry mechanism: ErrorMessage.next_retry_interval, StartMessage.retry_count_since_last_stored_entry and StartMessage.duration_since_last_stored_entry V2 = 2; } From 1cb5c7f610dce8a203b1d55ad227cad0e99f051e Mon Sep 17 00:00:00 2001 From: slinkydeveloper Date: Tue, 27 Aug 2024 18:28:23 +0200 Subject: [PATCH 5/5] next_retry_interval -> next_retry_delay --- dev/restate/service/protocol.proto | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dev/restate/service/protocol.proto b/dev/restate/service/protocol.proto index 56d87c6..f7aa8b8 100644 --- a/dev/restate/service/protocol.proto +++ b/dev/restate/service/protocol.proto @@ -20,7 +20,7 @@ enum ServiceProtocolVersion { // initial service protocol version V1 = 1; // Added - // * Entry retry mechanism: ErrorMessage.next_retry_interval, StartMessage.retry_count_since_last_stored_entry and StartMessage.duration_since_last_stored_entry + // * Entry retry mechanism: ErrorMessage.next_retry_delay, StartMessage.retry_count_since_last_stored_entry and StartMessage.duration_since_last_stored_entry V2 = 2; } @@ -106,9 +106,9 @@ message ErrorMessage { // Entry type. optional uint32 related_entry_type = 6; - // Interval before executing the next retry, specified as duration in milliseconds. + // Delay before executing the next retry, specified as duration in milliseconds. // If provided, it will override the default retry policy used by Restate's invoker ONLY for the next retry attempt. - optional uint64 next_retry_interval = 8; + optional uint64 next_retry_delay = 8; } // Type: 0x0000 + 4