From 1dcc8e17c4fbce2c1d36871e6059b60182a1c022 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Mon, 29 Jan 2024 14:22:14 -0500 Subject: [PATCH] New event: update requested (#351) Add new event EVENT_TYPE_WORKFLOW_EXECUTION_UPDATE_REQUESTED for update reapply. --- temporal/api/enums/v1/event_type.proto | 4 ++++ temporal/api/enums/v1/reset.proto | 2 ++ temporal/api/enums/v1/update.proto | 10 ++++++++++ temporal/api/history/v1/message.proto | 8 ++++++++ 4 files changed, 24 insertions(+) diff --git a/temporal/api/enums/v1/event_type.proto b/temporal/api/enums/v1/event_type.proto index a65529c8..1c0de0cf 100644 --- a/temporal/api/enums/v1/event_type.proto +++ b/temporal/api/enums/v1/event_type.proto @@ -167,4 +167,8 @@ enum EventType { EVENT_TYPE_ACTIVITY_PROPERTIES_MODIFIED_EXTERNALLY = 45; // Workflow properties modified by user workflow code EVENT_TYPE_WORKFLOW_PROPERTIES_MODIFIED = 46; + // An update was requested. Note that not all update requests result in this + // event. See UpdateRequestedEventOrigin for situations in which this event + // is created. + EVENT_TYPE_WORKFLOW_EXECUTION_UPDATE_REQUESTED = 47; } diff --git a/temporal/api/enums/v1/reset.proto b/temporal/api/enums/v1/reset.proto index 3bff9f7e..d39febd8 100644 --- a/temporal/api/enums/v1/reset.proto +++ b/temporal/api/enums/v1/reset.proto @@ -36,6 +36,8 @@ enum ResetReapplyExcludeType { RESET_REAPPLY_EXCLUDE_TYPE_UNSPECIFIED = 0; // Exclude signals when reapplying events. RESET_REAPPLY_EXCLUDE_TYPE_SIGNAL = 1; + // Exclude updates when reapplying events. + RESET_REAPPLY_EXCLUDE_TYPE_UPDATE = 2; } // Event types to include when reapplying events. Deprecated: applications diff --git a/temporal/api/enums/v1/update.proto b/temporal/api/enums/v1/update.proto index 6635288a..6f7c66ad 100644 --- a/temporal/api/enums/v1/update.proto +++ b/temporal/api/enums/v1/update.proto @@ -54,3 +54,13 @@ enum UpdateWorkflowExecutionLifecycleStage { // on a worker and has either been rejected or returned a value or an error. UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_COMPLETED = 3; } + +// Records why a WorkflowExecutionUpdateRequestedEvent was written to history. +// Note that not all update requests result in this event. +enum UpdateRequestedEventOrigin { + UPDATE_REQUESTED_EVENT_ORIGIN_UNSPECIFIED = 0; + // The UpdateRequested event was created when reapplying events during reset + // or replication. I.e. an accepted update on one branch of workflow history + // was converted into a requested update on a different branch. + UPDATE_REQUESTED_EVENT_ORIGIN_REAPPLY = 1; +} diff --git a/temporal/api/history/v1/message.proto b/temporal/api/history/v1/message.proto index 527ea84a..434f9df7 100644 --- a/temporal/api/history/v1/message.proto +++ b/temporal/api/history/v1/message.proto @@ -36,6 +36,7 @@ import "google/protobuf/timestamp.proto"; import "temporal/api/enums/v1/event_type.proto"; import "temporal/api/enums/v1/failed_cause.proto"; +import "temporal/api/enums/v1/update.proto"; import "temporal/api/enums/v1/workflow.proto"; import "temporal/api/common/v1/message.proto"; import "temporal/api/failure/v1/message.proto"; @@ -749,6 +750,12 @@ message WorkflowExecutionUpdateRejectedEventAttributes { temporal.api.failure.v1.Failure failure = 5; } +message WorkflowExecutionUpdateRequestedEventAttributes { + // The update request associated with this event. + temporal.api.update.v1.Request request = 1; + // An explanation of why this event was written to history. + temporal.api.enums.v1.UpdateRequestedEventOrigin origin = 2; +} // History events are the method by which Temporal SDKs advance (or recreate) workflow state. // See the `EventType` enum for more info about what each event is for. @@ -814,6 +821,7 @@ message HistoryEvent { WorkflowPropertiesModifiedExternallyEventAttributes workflow_properties_modified_externally_event_attributes = 49; ActivityPropertiesModifiedExternallyEventAttributes activity_properties_modified_externally_event_attributes = 50; WorkflowPropertiesModifiedEventAttributes workflow_properties_modified_event_attributes = 51; + WorkflowExecutionUpdateRequestedEventAttributes workflow_execution_update_requested_event_attributes = 52; } }