Skip to content

Commit

Permalink
Pass child initiated event version to child workflow (#2801)
Browse files Browse the repository at this point in the history
  • Loading branch information
yycptt committed May 4, 2022
1 parent 6614ea6 commit aa257cd
Show file tree
Hide file tree
Showing 18 changed files with 741 additions and 583 deletions.
604 changes: 323 additions & 281 deletions api/historyservice/v1/request_response.pb.go

Large diffs are not rendered by default.

493 changes: 269 additions & 224 deletions api/persistence/v1/executions.pb.go

Large diffs are not rendered by default.

99 changes: 70 additions & 29 deletions api/workflow/v1/message.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ require (
go.opentelemetry.io/otel/metric v0.29.0
go.opentelemetry.io/otel/sdk v1.6.3
go.opentelemetry.io/otel/sdk/metric v0.29.0
go.temporal.io/api v1.7.1-0.20220429205751-8a73b1f896d0
go.temporal.io/api v1.7.1-0.20220504205736-d21ec94bbedb
go.temporal.io/sdk v1.14.1-0.20220429221638-3a2b86ebed54
go.temporal.io/version v0.3.0
go.uber.org/atomic v1.9.0
Expand Down Expand Up @@ -104,12 +104,12 @@ require (
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect
golang.org/x/sys v0.0.0-20220429121018-84afa8d3f7b3 // indirect
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/tools v0.1.10 // indirect
golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220429170224-98d788798c3e // indirect
google.golang.org/genproto v0.0.0-20220504150022-98cd25cafc72 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
lukechampine.com/uint128 v1.2.0 // indirect
Expand Down
9 changes: 6 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,9 @@ go.opentelemetry.io/otel/sdk/metric v0.29.0/go.mod h1:IFkFNKI8Gq8zBdqOKdODCL9+LI
go.opentelemetry.io/otel/trace v1.6.3 h1:IqN4L+5b0mPNjdXIiZ90Ni4Bl5BRkDQywePLWemd9bc=
go.opentelemetry.io/otel/trace v1.6.3/go.mod h1:GNJQusJlUgZl9/TQBPKU/Y/ty+0iVB5fjhKeJGZPGFs=
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
go.temporal.io/api v1.7.1-0.20220429205751-8a73b1f896d0 h1:TCljuP7nzCO0a9fMHcYsKAtacMTt92FxS1EkFzB/9NY=
go.temporal.io/api v1.7.1-0.20220429205751-8a73b1f896d0/go.mod h1:QXFU+pt4JL280LYD40YrvLelG1jfei1TZ0GD7X3DLSg=
go.temporal.io/api v1.7.1-0.20220504205736-d21ec94bbedb h1:OJ8HqmvirSPUh3hMHcyroUmouhTK8Kul+33045iaOZk=
go.temporal.io/api v1.7.1-0.20220504205736-d21ec94bbedb/go.mod h1:CC6Y6/sdqu//fcK03bRiVe68Qu0tuB3QBbQ+xZel75k=
go.temporal.io/sdk v1.14.1-0.20220429221638-3a2b86ebed54 h1:2h9Fyc7rdARX4+3sZnup/qz6kZKW2GXF06mxYJ3PSMY=
go.temporal.io/sdk v1.14.1-0.20220429221638-3a2b86ebed54/go.mod h1:6GXFBXb11hWtZbpHdYz7JkEWqPhjX8kMYzE4M0Vpua0=
go.temporal.io/version v0.3.0 h1:dMrei9l9NyHt8nG6EB8vAwDLLTwx2SvRyucCSumAiig=
Expand Down Expand Up @@ -668,8 +669,9 @@ golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220429121018-84afa8d3f7b3 h1:kBsBifDikLCf5sUMbcD8p73OinDtAQWQp8+n7FiyzlA=
golang.org/x/sys v0.0.0-20220429121018-84afa8d3f7b3/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 h1:nonptSpoQ4vQjyraW20DXPAglgQfVnM9ZC6MmNLMR60=
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down Expand Up @@ -871,8 +873,9 @@ google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2
google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E=
google.golang.org/genproto v0.0.0-20220405205423-9d709892a2bf/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo=
google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo=
google.golang.org/genproto v0.0.0-20220429170224-98d788798c3e h1:gMjH4zLGs9m+dGzR7qHCHaXMOwsJHJKKkHtyXhtOrJk=
google.golang.org/genproto v0.0.0-20220429170224-98d788798c3e/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo=
google.golang.org/genproto v0.0.0-20220504150022-98cd25cafc72 h1:iif0mpUetMBqcQPUoq+JnCcmzvfpp8wRx515va8wP1c=
google.golang.org/genproto v0.0.0-20220504150022-98cd25cafc72/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4=
google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
Expand Down
2 changes: 1 addition & 1 deletion proto/api
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,11 @@ message ScheduleWorkflowTaskResponse {
message RecordChildExecutionCompletedRequest {
string namespace_id = 1;
temporal.api.common.v1.WorkflowExecution workflow_execution = 2;
int64 initiated_id = 3;
int64 parent_initiated_id = 3;
temporal.api.common.v1.WorkflowExecution completed_execution = 4;
temporal.api.history.v1.HistoryEvent completion_event = 5;
temporal.server.api.clock.v1.ShardClock clock = 6;
int64 parent_initiated_version = 7;
}

message RecordChildExecutionCompletedResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ message WorkflowExecutionInfo {
string parent_namespace_id = 3;
string parent_workflow_id = 4;
string parent_run_id = 5;
int64 initiated_id = 6;
int64 parent_initiated_id = 6;
int64 completion_event_batch_id = 7;
reserved 8;
string task_queue = 9;
Expand Down Expand Up @@ -130,6 +130,8 @@ message WorkflowExecutionInfo {
// If continued-as-new, or retried, or cron, holds the new run id.
string new_execution_run_id = 61;
temporal.server.api.clock.v1.ShardClock parent_clock = 62;
// version of child execution initiated event in parent workflow
int64 parent_initiated_version = 63;
}

message ExecutionStats {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ message ParentExecutionInfo {
temporal.api.common.v1.WorkflowExecution execution = 3;
int64 initiated_id = 4;
temporal.server.api.clock.v1.ShardClock clock = 5;
int64 initiated_version = 6;
}
2 changes: 1 addition & 1 deletion service/history/historyEngine.go
Original file line number Diff line number Diff line change
Expand Up @@ -2176,7 +2176,7 @@ func (e *historyEngineImpl) RecordChildExecutionCompleted(
return nil, consts.ErrWorkflowCompleted
}

initiatedID := completionRequest.InitiatedId
initiatedID := completionRequest.ParentInitiatedId
completedExecution := completionRequest.CompletedExecution
completionEvent := completionRequest.CompletionEvent

Expand Down
6 changes: 4 additions & 2 deletions service/history/historyEngine2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,8 @@ func (s *engine2Suite) TestRequestCancelWorkflowExecution_ParentMismatch() {
WorkflowId: "parent wId",
RunId: "parent rId",
},
InitiatedId: 123,
InitiatedId: 123,
InitiatedVersion: 456,
}

identity := "testIdentity"
Expand Down Expand Up @@ -855,7 +856,8 @@ func (s *engine2Suite) TestTerminateWorkflowExecution_ParentMismatch() {
WorkflowId: "parent wId",
RunId: "parent rId",
},
InitiatedId: 123,
InitiatedId: 123,
InitiatedVersion: 456,
}

identity := "testIdentity"
Expand Down
11 changes: 7 additions & 4 deletions service/history/transferQueueActiveTaskExecutor.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,8 @@ func (t *transferQueueActiveTaskExecutor) processCloseExecution(
parentNamespaceID := executionInfo.ParentNamespaceId
parentWorkflowID := executionInfo.ParentWorkflowId
parentRunID := executionInfo.ParentRunId
initiatedID := executionInfo.InitiatedId
parentInitiatedID := executionInfo.ParentInitiatedId
parentInitiatedVersion := executionInfo.ParentInitiatedVersion
var parentClock *clockpb.ShardClock
if executionInfo.ParentClock != nil {
parentClock = vclock.NewShardClock(executionInfo.ParentClock.Id, executionInfo.ParentClock.Clock)
Expand Down Expand Up @@ -328,7 +329,8 @@ func (t *transferQueueActiveTaskExecutor) processCloseExecution(
WorkflowId: parentWorkflowID,
RunId: parentRunID,
},
InitiatedId: initiatedID,
ParentInitiatedId: parentInitiatedID,
ParentInitiatedVersion: parentInitiatedVersion,
CompletedExecution: &commonpb.WorkflowExecution{
WorkflowId: task.WorkflowID,
RunId: task.RunID,
Expand Down Expand Up @@ -1235,8 +1237,9 @@ func (t *transferQueueActiveTaskExecutor) startWorkflowWithRetry(
WorkflowId: task.WorkflowID,
RunId: task.RunID,
},
InitiatedId: task.InitiatedID,
Clock: vclock.NewShardClock(t.shard.GetShardID(), task.TaskID),
InitiatedId: task.InitiatedID,
InitiatedVersion: task.Version,
Clock: vclock.NewShardClock(t.shard.GetShardID(), task.TaskID),
},
t.shard.GetTimeSource().Now(),
)
Expand Down

0 comments on commit aa257cd

Please sign in to comment.