From fb8a5e0c3bc1d2315512a344e942c9613a7bfa3b Mon Sep 17 00:00:00 2001 From: Yichao Yang Date: Tue, 8 Feb 2022 10:38:53 -0800 Subject: [PATCH] Fix admin handler getTaskType implementation (#2474) --- service/frontend/adminHandler.go | 42 ++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/service/frontend/adminHandler.go b/service/frontend/adminHandler.go index 3cf341048e0..36b2bb60808 100644 --- a/service/frontend/adminHandler.go +++ b/service/frontend/adminHandler.go @@ -1728,22 +1728,54 @@ func (adh *AdminHandler) error(err error, scope metrics.Scope) error { func getTaskType(task tasks.Task) (enumsspb.TaskType, error) { var taskType enumsspb.TaskType switch task := task.(type) { + // Replication + case *tasks.HistoryReplicationTask: + taskType = enumsspb.TASK_TYPE_REPLICATION_HISTORY + case *tasks.SyncActivityTask: + taskType = enumsspb.TASK_TYPE_REPLICATION_SYNC_ACTIVITY + // Transfer + case *tasks.WorkflowTask: + taskType = enumsspb.TASK_TYPE_TRANSFER_WORKFLOW_TASK + case *tasks.ActivityTask: + taskType = enumsspb.TASK_TYPE_TRANSFER_ACTIVITY_TASK + case *tasks.CloseExecutionTask: + taskType = enumsspb.TASK_TYPE_TRANSFER_CLOSE_EXECUTION + case *tasks.CancelExecutionTask: + taskType = enumsspb.TASK_TYPE_TRANSFER_CANCEL_EXECUTION + case *tasks.StartChildExecutionTask: + taskType = enumsspb.TASK_TYPE_TRANSFER_START_CHILD_EXECUTION + case *tasks.SignalExecutionTask: + taskType = enumsspb.TASK_TYPE_TRANSFER_SIGNAL_EXECUTION + case *tasks.ResetWorkflowTask: + taskType = enumsspb.TASK_TYPE_TRANSFER_RESET_WORKFLOW + case *tasks.DeleteExecutionTask: + taskType = enumsspb.TASK_TYPE_TRANSFER_DELETE_EXECUTION + // Timer case *tasks.WorkflowTaskTimeoutTask: taskType = enumsspb.TASK_TYPE_WORKFLOW_TASK_TIMEOUT - case *tasks.WorkflowBackoffTimerTask: - taskType = enumsspb.TASK_TYPE_WORKFLOW_BACKOFF_TIMER case *tasks.ActivityTimeoutTask: taskType = enumsspb.TASK_TYPE_ACTIVITY_TIMEOUT - case *tasks.ActivityRetryTimerTask: - taskType = enumsspb.TASK_TYPE_ACTIVITY_RETRY_TIMER case *tasks.UserTimerTask: taskType = enumsspb.TASK_TYPE_USER_TIMER case *tasks.WorkflowTimeoutTask: taskType = enumsspb.TASK_TYPE_WORKFLOW_RUN_TIMEOUT case *tasks.DeleteHistoryEventTask: taskType = enumsspb.TASK_TYPE_DELETE_HISTORY_EVENT + case *tasks.ActivityRetryTimerTask: + taskType = enumsspb.TASK_TYPE_ACTIVITY_RETRY_TIMER + case *tasks.WorkflowBackoffTimerTask: + taskType = enumsspb.TASK_TYPE_WORKFLOW_BACKOFF_TIMER + // Visibility + case *tasks.StartExecutionVisibilityTask: + taskType = enumsspb.TASK_TYPE_VISIBILITY_START_EXECUTION + case *tasks.UpsertExecutionVisibilityTask: + taskType = enumsspb.TASK_TYPE_VISIBILITY_UPSERT_EXECUTION + case *tasks.CloseExecutionVisibilityTask: + taskType = enumsspb.TASK_TYPE_VISIBILITY_CLOSE_EXECUTION + case *tasks.DeleteExecutionVisibilityTask: + taskType = enumsspb.TASK_TYPE_VISIBILITY_DELETE_EXECUTION default: - return 0, serviceerror.NewInternal(fmt.Sprintf("Unknown timer task type: %v", task)) + return 0, serviceerror.NewInternal(fmt.Sprintf("Unknown task type: %v", task)) } return taskType, nil