Skip to content

Commit

Permalink
Rename workflow_task_info to transient_workflow_task_info (#3115)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexshtin committed Jul 18, 2022
1 parent 378759c commit d85d678
Show file tree
Hide file tree
Showing 9 changed files with 439 additions and 441 deletions.
584 changes: 292 additions & 292 deletions api/historyservice/v1/request_response.pb.go

Large diffs are not rendered by default.

264 changes: 132 additions & 132 deletions api/matchingservice/v1/request_response.pb.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion common/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ func CreateMatchingPollWorkflowTaskQueueResponse(historyResponse *historyservice
Attempt: historyResponse.GetAttempt(),
NextEventId: historyResponse.NextEventId,
StickyExecutionEnabled: historyResponse.StickyExecutionEnabled,
WorkflowTaskInfo: historyResponse.WorkflowTaskInfo,
TransientWorkflowTask: historyResponse.TransientWorkflowTask,
WorkflowExecutionTaskQueue: historyResponse.WorkflowExecutionTaskQueue,
BranchToken: historyResponse.BranchToken,
ScheduledTime: historyResponse.ScheduledTime,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ import "temporal/server/api/replication/v1/message.proto";
import "temporal/server/api/persistence/v1/executions.proto";
import "temporal/server/api/persistence/v1/workflow_mutable_state.proto";

// TODO: remove these dependencies
import "temporal/api/workflowservice/v1/request_response.proto";
import "temporal/server/api/adminservice/v1/request_response.proto";

Expand Down Expand Up @@ -157,7 +156,7 @@ message RecordWorkflowTaskStartedResponse {
int64 next_event_id = 5;
int32 attempt = 6;
bool sticky_execution_enabled = 7;
temporal.server.api.history.v1.TransientWorkflowTaskInfo workflow_task_info = 8;
temporal.server.api.history.v1.TransientWorkflowTaskInfo transient_workflow_task = 8;
temporal.api.taskqueue.v1.TaskQueue workflow_execution_task_queue = 9;
reserved 10;
bytes branch_token = 11;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import "temporal/server/api/clock/v1/message.proto";
import "temporal/server/api/enums/v1/task.proto";
import "temporal/server/api/history/v1/message.proto";

// TODO: remove this dependency
import "temporal/api/workflowservice/v1/request_response.proto";

message PollWorkflowTaskQueueRequest {
Expand All @@ -58,7 +57,7 @@ message PollWorkflowTaskQueueResponse {
int64 backlog_count_hint = 8;
bool sticky_execution_enabled = 9;
temporal.api.query.v1.WorkflowQuery query = 10;
temporal.server.api.history.v1.TransientWorkflowTaskInfo workflow_task_info = 11;
temporal.server.api.history.v1.TransientWorkflowTaskInfo transient_workflow_task = 11;
temporal.api.taskqueue.v1.TaskQueue workflow_execution_task_queue = 12;
reserved 13;
bytes branch_token = 14;
Expand Down
12 changes: 6 additions & 6 deletions service/frontend/workflowHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -4012,20 +4012,20 @@ func (wh *WorkflowHandler) validateTransientWorkflowTaskEvents(
return nil
}

func extractHistorySuffix(transientTasks *historyspb.TransientWorkflowTaskInfo) []*historypb.HistoryEvent {
func extractHistorySuffix(transientWorkflowTask *historyspb.TransientWorkflowTaskInfo) []*historypb.HistoryEvent {
// TODO (mmcshane): remove this function after v1.18 is release as we will
// be able to just use transientTasks.HistorySuffix directly and the other
// be able to just use transientWorkflowTask.HistorySuffix directly and the other
// fields will be removed.

suffix := transientTasks.HistorySuffix
suffix := transientWorkflowTask.HistorySuffix
if len(suffix) == 0 {
// HistorySuffix is a new field - we may still need to handle
// instances that carry the separate ScheduledEvent and StartedEvent
// fields

// One might be tempted to check for nil here but the old code did not
// make that check and we aim to preserve compatiblity
suffix = append(suffix, transientTasks.ScheduledEvent, transientTasks.StartedEvent)
suffix = append(suffix, transientWorkflowTask.ScheduledEvent, transientWorkflowTask.StartedEvent)
}
return suffix
}
Expand Down Expand Up @@ -4129,7 +4129,7 @@ func (wh *WorkflowHandler) createPollWorkflowTaskQueueResponse(
nextEventID,
int32(wh.config.HistoryMaxPageSize(namespaceEntry.Name().String())),
nil,
matchingResp.GetWorkflowTaskInfo(),
matchingResp.GetTransientWorkflowTask(),
branchToken,
)
if err != nil {
Expand All @@ -4142,7 +4142,7 @@ func (wh *WorkflowHandler) createPollWorkflowTaskQueueResponse(
FirstEventId: firstEventID,
NextEventId: nextEventID,
PersistenceToken: persistenceToken,
TransientWorkflowTask: matchingResp.GetWorkflowTaskInfo(),
TransientWorkflowTask: matchingResp.GetTransientWorkflowTask(),
BranchToken: branchToken,
})
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion service/frontend/workflowHandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ func (s *workflowHandlerSuite) TestTransientTaskInjection() {
WorkflowId: "wfid:" + s.T().Name(),
RunId: "1",
},
WorkflowTaskInfo: &tc.taskInfo,
TransientWorkflowTask: &tc.taskInfo,
},
nil,
)
Expand Down
8 changes: 4 additions & 4 deletions service/history/workflowTaskHandlerCallbacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -682,13 +682,13 @@ func (handler *workflowTaskHandlerCallbacksImpl) createRecordWorkflowTaskStarted
// This workflowTask is retried from mutable state
// Also return schedule and started which are not written to history yet
scheduledEvent, startedEvent := msBuilder.CreateTransientWorkflowTaskEvents(workflowTask, identity)
response.WorkflowTaskInfo = &historyspb.TransientWorkflowTaskInfo{}
response.TransientWorkflowTask = &historyspb.TransientWorkflowTaskInfo{}

// TODO (mmcshane): remove population of ScheduledEvent and StartedEvent
// after v1.18 is released
response.WorkflowTaskInfo.ScheduledEvent = scheduledEvent
response.WorkflowTaskInfo.StartedEvent = startedEvent
response.WorkflowTaskInfo.HistorySuffix = []*historypb.HistoryEvent{scheduledEvent, startedEvent}
response.TransientWorkflowTask.ScheduledEvent = scheduledEvent
response.TransientWorkflowTask.StartedEvent = startedEvent
response.TransientWorkflowTask.HistorySuffix = []*historypb.HistoryEvent{scheduledEvent, startedEvent}
}
currentBranchToken, err := msBuilder.GetCurrentBranchToken()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion service/matching/matchingEngine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ func (s *matchingEngineSuite) TestPollWorkflowTaskQueues() {
BacklogCountHint: 1,
StickyExecutionEnabled: true,
Query: nil,
WorkflowTaskInfo: nil,
TransientWorkflowTask: nil,
WorkflowExecutionTaskQueue: &taskqueuepb.TaskQueue{
Name: tl,
Kind: enumspb.TASK_QUEUE_KIND_NORMAL,
Expand Down

0 comments on commit d85d678

Please sign in to comment.