diff --git a/.gen/go/sqlblobs/idl.go b/.gen/go/sqlblobs/idl.go index 389b9496762..04fcae2b453 100644 --- a/.gen/go/sqlblobs/idl.go +++ b/.gen/go/sqlblobs/idl.go @@ -33,11 +33,11 @@ var ThriftModule = &thriftreflect.ThriftModule{ Name: "sqlblobs", Package: "github.com/uber/cadence/.gen/go/sqlblobs", FilePath: "sqlblobs.thrift", - SHA1: "7d621e6b1e2fd96b0b79f804872e2c2cae0fed1a", + SHA1: "4e175efebe843be1ae2668ae45d28873a3c77492", Includes: []*thriftreflect.ThriftModule{ shared.ThriftModule, }, Raw: rawIDL, } -const rawIDL = "// Copyright (c) 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nnamespace java com.uber.cadence.sqlblobs\n\ninclude \"shared.thrift\"\n\nstruct ShardInfo {\n 10: optional i32 stolenSinceRenew\n 12: optional i64 (js.type = \"Long\") updatedAtNanos\n 14: optional i64 (js.type = \"Long\") replicationAckLevel\n 16: optional i64 (js.type = \"Long\") transferAckLevel\n 18: optional i64 (js.type = \"Long\") timerAckLevelNanos\n 24: optional i64 (js.type = \"Long\") domainNotificationVersion\n 34: optional map clusterTransferAckLevel\n 36: optional map clusterTimerAckLevel\n 38: optional string owner\n}\n\nstruct DomainInfo {\n 10: optional string name\n 12: optional string description\n 14: optional string owner\n 16: optional i32 status\n 18: optional i16 retentionDays\n 20: optional bool emitMetric\n 22: optional string archivalBucket\n 24: optional i16 archivalStatus\n 26: optional i64 (js.type = \"Long\") configVersion\n 28: optional i64 (js.type = \"Long\") notificationVersion\n 30: optional i64 (js.type = \"Long\") failoverNotificationVersion\n 32: optional i64 (js.type = \"Long\") failoverVersion\n 34: optional string activeClusterName\n 36: optional list clusters\n 38: optional map data\n 39: optional binary badBinaries\n 40: optional string badBinariesEncoding\n}\n\nstruct HistoryTreeInfo {\n 10: optional i64 (js.type = \"Long\") createdTimeNanos // For fork operation to prevent race condition of leaking event data when forking branches fail. Also can be used for clean up leaked data\n 12: optional list ancestors\n 14: optional string info // For lookup back to workflow during debugging, also background cleanup when fork operation cannot finish self cleanup due to crash.\n}\n\nstruct ReplicationInfo {\n 10: optional i64 (js.type = \"Long\") version\n 12: optional i64 (js.type = \"Long\") lastEventID\n}\n\nstruct WorkflowExecutionInfo {\n 10: optional binary parentDomainID\n 12: optional string parentWorkflowID\n 14: optional binary parentRunID\n 16: optional i64 (js.type = \"Long\") initiatedID\n 18: optional i64 (js.type = \"Long\") completionEventBatchID\n 20: optional binary completionEvent\n 22: optional string completionEventEncoding\n 24: optional string taskList\n 26: optional string workflowTypeName\n 28: optional i32 workflowTimeoutSeconds\n 30: optional i32 decisionTaskTimeoutSeconds\n 32: optional binary executionContext\n 34: optional i32 state\n 36: optional i32 closeStatus\n 38: optional i64 (js.type = \"Long\") startVersion\n 40: optional i64 (js.type = \"Long\") currentVersion\n 44: optional i64 (js.type = \"Long\") lastWriteEventID\n 46: optional map lastReplicationInfo\n 48: optional i64 (js.type = \"Long\") lastEventTaskID\n 50: optional i64 (js.type = \"Long\") lastFirstEventID\n 52: optional i64 (js.type = \"Long\") lastProcessedEvent\n 54: optional i64 (js.type = \"Long\") startTimeNanos\n 56: optional i64 (js.type = \"Long\") lastUpdatedTimeNanos\n 58: optional i64 (js.type = \"Long\") decisionVersion\n 60: optional i64 (js.type = \"Long\") decisionScheduleID\n 62: optional i64 (js.type = \"Long\") decisionStartedID\n 64: optional i32 decisionTimeout\n 66: optional i64 (js.type = \"Long\") decisionAttempt\n 68: optional i64 (js.type = \"Long\") decisionStartedTimestampNanos\n 69: optional i64 (js.type = \"Long\") decisionScheduledTimestampNanos\n 70: optional bool cancelRequested\n 72: optional string createRequestID\n 74: optional string decisionRequestID\n 76: optional string cancelRequestID\n 78: optional string stickyTaskList\n 80: optional i64 (js.type = \"Long\") stickyScheduleToStartTimeout\n 82: optional i64 (js.type = \"Long\") retryAttempt\n 84: optional i32 retryInitialIntervalSeconds\n 86: optional i32 retryMaximumIntervalSeconds\n 88: optional i32 retryMaximumAttempts\n 90: optional i32 retryExpirationSeconds\n 92: optional double retryBackoffCoefficient\n 94: optional i64 (js.type = \"Long\") retryExpirationTimeNanos\n 96: optional list retryNonRetryableErrors\n 98: optional bool hasRetryPolicy\n 100: optional string cronSchedule\n 102: optional i32 eventStoreVersion\n 104: optional binary eventBranchToken\n 106: optional i64 (js.type = \"Long\") signalCount\n 108: optional i64 (js.type = \"Long\") historySize\n 110: optional string clientLibraryVersion\n 112: optional string clientFeatureVersion\n 114: optional string clientImpl\n 115: optional binary autoResetPoints\n 116: optional string autoResetPointsEncoding\n 118: optional map searchAttributes\n}\n\nstruct ActivityInfo {\n 10: optional i64 (js.type = \"Long\") version\n 12: optional i64 (js.type = \"Long\") scheduledEventBatchID\n 14: optional binary scheduledEvent\n 16: optional string scheduledEventEncoding\n 18: optional i64 (js.type = \"Long\") scheduledTimeNanos\n 20: optional i64 (js.type = \"Long\") startedID\n 22: optional binary startedEvent\n 24: optional string startedEventEncoding\n 26: optional i64 (js.type = \"Long\") startedTimeNanos\n 28: optional string activityID\n 30: optional string requestID\n 32: optional i32 scheduleToStartTimeoutSeconds\n 34: optional i32 scheduleToCloseTimeoutSeconds\n 36: optional i32 startToCloseTimeoutSeconds\n 38: optional i32 heartbeatTimeoutSeconds\n 40: optional bool cancelRequested\n 42: optional i64 (js.type = \"Long\") cancelRequestID\n 44: optional i32 timerTaskStatus\n 46: optional i32 attempt\n 48: optional string taskList\n 50: optional string startedIdentity\n 52: optional bool hasRetryPolicy\n 54: optional i32 retryInitialIntervalSeconds\n 56: optional i32 retryMaximumIntervalSeconds\n 58: optional i32 retryMaximumAttempts\n 60: optional i64 (js.type = \"Long\") retryExpirationTimeNanos\n 62: optional double retryBackoffCoefficient\n 64: optional list retryNonRetryableErrors\n}\n\nstruct ChildExecutionInfo {\n 10: optional i64 (js.type = \"Long\") version\n 12: optional i64 (js.type = \"Long\") initiatedEventBatchID\n 14: optional i64 (js.type = \"Long\") startedID\n 16: optional binary initiatedEvent\n 18: optional string initiatedEventEncoding\n 20: optional string startedWorkflowID\n 22: optional binary startedRunID\n 24: optional binary startedEvent\n 26: optional string startedEventEncoding\n 28: optional string createRequestID\n 30: optional string domainName\n 32: optional string workflowTypeName\n}\n\nstruct SignalInfo {\n 10: optional i64 (js.type = \"Long\") version\n 12: optional string requestID\n 14: optional string name\n 16: optional binary input\n 18: optional binary control\n}\n\nstruct RequestCancelInfo {\n 10: optional i64 (js.type = \"Long\") version\n 12: optional string cancelRequestID\n}\n\nstruct TimerInfo {\n 10: optional i64 (js.type = \"Long\") version\n 12: optional i64 (js.type = \"Long\") startedID\n 14: optional i64 (js.type = \"Long\") expiryTimeNanos\n 16: optional i64 (js.type = \"Long\") taskID\n}\n\nstruct TaskInfo {\n 10: optional string workflowID\n 12: optional binary runID\n 13: optional i64 (js.type = \"Long\") scheduleID\n 14: optional i64 (js.type = \"Long\") expiryTimeNanos\n}\n\nstruct TaskListInfo {\n 10: optional i16 kind // {Normal, Sticky}\n 12: optional i64 (js.type = \"Long\") ackLevel\n 14: optional i64 (js.type = \"Long\") expiryTimeNanos\n 16: optional i64 (js.type = \"Long\") lastUpdatedNanos\n}\n\nstruct TransferTaskInfo {\n 10: optional binary domainID\n 12: optional string workflowID\n 14: optional binary runID\n 16: optional i16 taskType\n 18: optional binary targetDomainID\n 20: optional string targetWorkflowID\n 22: optional binary targetRunID\n 24: optional string taskList\n 26: optional bool targetChildWorkflowOnly\n 28: optional i64 (js.type = \"Long\") scheduleID\n 30: optional i64 (js.type = \"Long\") version\n 32: optional i64 (js.type = \"Long\") visibilityTimestampNanos\n}\n\nstruct TimerTaskInfo {\n 10: optional binary domainID\n 12: optional string workflowID\n 14: optional binary runID\n 16: optional i16 taskType\n 18: optional i16 timeoutType\n 20: optional i64 (js.type = \"Long\") version\n 22: optional i64 (js.type = \"Long\") scheduleAttempt\n 24: optional i64 (js.type = \"Long\") eventID\n}\n\nstruct ReplicationTaskInfo {\n 10: optional binary domainID\n 12: optional string workflowID\n 14: optional binary runID\n 16: optional i16 taskType\n 18: optional i64 (js.type = \"Long\") version\n 20: optional i64 (js.type = \"Long\") firstEventID\n 22: optional i64 (js.type = \"Long\") nextEventID\n 24: optional i64 (js.type = \"Long\") scheduledID\n 26: optional i32 eventStoreVersion\n 28: optional i32 newRunEventStoreVersion\n 30: optional binary branch_token\n 32: optional map lastReplicationInfo\n 34: optional binary newRunBranchToken\n 36: optional bool resetWorkflow\n}" +const rawIDL = "// Copyright (c) 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nnamespace java com.uber.cadence.sqlblobs\n\ninclude \"shared.thrift\"\n\nstruct ShardInfo {\n 10: optional i32 stolenSinceRenew\n 12: optional i64 (js.type = \"Long\") updatedAtNanos\n 14: optional i64 (js.type = \"Long\") replicationAckLevel\n 16: optional i64 (js.type = \"Long\") transferAckLevel\n 18: optional i64 (js.type = \"Long\") timerAckLevelNanos\n 24: optional i64 (js.type = \"Long\") domainNotificationVersion\n 34: optional map clusterTransferAckLevel\n 36: optional map clusterTimerAckLevel\n 38: optional string owner\n}\n\nstruct DomainInfo {\n 10: optional string name\n 12: optional string description\n 14: optional string owner\n 16: optional i32 status\n 18: optional i16 retentionDays\n 20: optional bool emitMetric\n 22: optional string archivalBucket\n 24: optional i16 archivalStatus\n 26: optional i64 (js.type = \"Long\") configVersion\n 28: optional i64 (js.type = \"Long\") notificationVersion\n 30: optional i64 (js.type = \"Long\") failoverNotificationVersion\n 32: optional i64 (js.type = \"Long\") failoverVersion\n 34: optional string activeClusterName\n 36: optional list clusters\n 38: optional map data\n 39: optional binary badBinaries\n 40: optional string badBinariesEncoding\n}\n\nstruct HistoryTreeInfo {\n 10: optional i64 (js.type = \"Long\") createdTimeNanos // For fork operation to prevent race condition of leaking event data when forking branches fail. Also can be used for clean up leaked data\n 12: optional list ancestors\n 14: optional string info // For lookup back to workflow during debugging, also background cleanup when fork operation cannot finish self cleanup due to crash.\n}\n\nstruct ReplicationInfo {\n 10: optional i64 (js.type = \"Long\") version\n 12: optional i64 (js.type = \"Long\") lastEventID\n}\n\nstruct WorkflowExecutionInfo {\n 10: optional binary parentDomainID\n 12: optional string parentWorkflowID\n 14: optional binary parentRunID\n 16: optional i64 (js.type = \"Long\") initiatedID\n 18: optional i64 (js.type = \"Long\") completionEventBatchID\n 20: optional binary completionEvent\n 22: optional string completionEventEncoding\n 24: optional string taskList\n 26: optional string workflowTypeName\n 28: optional i32 workflowTimeoutSeconds\n 30: optional i32 decisionTaskTimeoutSeconds\n 32: optional binary executionContext\n 34: optional i32 state\n 36: optional i32 closeStatus\n 38: optional i64 (js.type = \"Long\") startVersion\n 40: optional i64 (js.type = \"Long\") currentVersion\n 44: optional i64 (js.type = \"Long\") lastWriteEventID\n 46: optional map lastReplicationInfo\n 48: optional i64 (js.type = \"Long\") lastEventTaskID\n 50: optional i64 (js.type = \"Long\") lastFirstEventID\n 52: optional i64 (js.type = \"Long\") lastProcessedEvent\n 54: optional i64 (js.type = \"Long\") startTimeNanos\n 56: optional i64 (js.type = \"Long\") lastUpdatedTimeNanos\n 58: optional i64 (js.type = \"Long\") decisionVersion\n 60: optional i64 (js.type = \"Long\") decisionScheduleID\n 62: optional i64 (js.type = \"Long\") decisionStartedID\n 64: optional i32 decisionTimeout\n 66: optional i64 (js.type = \"Long\") decisionAttempt\n 68: optional i64 (js.type = \"Long\") decisionStartedTimestampNanos\n 69: optional i64 (js.type = \"Long\") decisionScheduledTimestampNanos\n 70: optional bool cancelRequested\n 72: optional string createRequestID\n 74: optional string decisionRequestID\n 76: optional string cancelRequestID\n 78: optional string stickyTaskList\n 80: optional i64 (js.type = \"Long\") stickyScheduleToStartTimeout\n 82: optional i64 (js.type = \"Long\") retryAttempt\n 84: optional i32 retryInitialIntervalSeconds\n 86: optional i32 retryMaximumIntervalSeconds\n 88: optional i32 retryMaximumAttempts\n 90: optional i32 retryExpirationSeconds\n 92: optional double retryBackoffCoefficient\n 94: optional i64 (js.type = \"Long\") retryExpirationTimeNanos\n 96: optional list retryNonRetryableErrors\n 98: optional bool hasRetryPolicy\n 100: optional string cronSchedule\n 102: optional i32 eventStoreVersion\n 104: optional binary eventBranchToken\n 106: optional i64 (js.type = \"Long\") signalCount\n 108: optional i64 (js.type = \"Long\") historySize\n 110: optional string clientLibraryVersion\n 112: optional string clientFeatureVersion\n 114: optional string clientImpl\n 115: optional binary autoResetPoints\n 116: optional string autoResetPointsEncoding\n 118: optional map searchAttributes\n}\n\nstruct ActivityInfo {\n 10: optional i64 (js.type = \"Long\") version\n 12: optional i64 (js.type = \"Long\") scheduledEventBatchID\n 14: optional binary scheduledEvent\n 16: optional string scheduledEventEncoding\n 18: optional i64 (js.type = \"Long\") scheduledTimeNanos\n 20: optional i64 (js.type = \"Long\") startedID\n 22: optional binary startedEvent\n 24: optional string startedEventEncoding\n 26: optional i64 (js.type = \"Long\") startedTimeNanos\n 28: optional string activityID\n 30: optional string requestID\n 32: optional i32 scheduleToStartTimeoutSeconds\n 34: optional i32 scheduleToCloseTimeoutSeconds\n 36: optional i32 startToCloseTimeoutSeconds\n 38: optional i32 heartbeatTimeoutSeconds\n 40: optional bool cancelRequested\n 42: optional i64 (js.type = \"Long\") cancelRequestID\n 44: optional i32 timerTaskStatus\n 46: optional i32 attempt\n 48: optional string taskList\n 50: optional string startedIdentity\n 52: optional bool hasRetryPolicy\n 54: optional i32 retryInitialIntervalSeconds\n 56: optional i32 retryMaximumIntervalSeconds\n 58: optional i32 retryMaximumAttempts\n 60: optional i64 (js.type = \"Long\") retryExpirationTimeNanos\n 62: optional double retryBackoffCoefficient\n 64: optional list retryNonRetryableErrors\n}\n\nstruct ChildExecutionInfo {\n 10: optional i64 (js.type = \"Long\") version\n 12: optional i64 (js.type = \"Long\") initiatedEventBatchID\n 14: optional i64 (js.type = \"Long\") startedID\n 16: optional binary initiatedEvent\n 18: optional string initiatedEventEncoding\n 20: optional string startedWorkflowID\n 22: optional binary startedRunID\n 24: optional binary startedEvent\n 26: optional string startedEventEncoding\n 28: optional string createRequestID\n 30: optional string domainName\n 32: optional string workflowTypeName\n}\n\nstruct SignalInfo {\n 10: optional i64 (js.type = \"Long\") version\n 12: optional string requestID\n 14: optional string name\n 16: optional binary input\n 18: optional binary control\n}\n\nstruct RequestCancelInfo {\n 10: optional i64 (js.type = \"Long\") version\n 12: optional string cancelRequestID\n}\n\nstruct TimerInfo {\n 10: optional i64 (js.type = \"Long\") version\n 12: optional i64 (js.type = \"Long\") startedID\n 14: optional i64 (js.type = \"Long\") expiryTimeNanos\n 16: optional i64 (js.type = \"Long\") taskID\n}\n\nstruct TaskInfo {\n 10: optional string workflowID\n 12: optional binary runID\n 13: optional i64 (js.type = \"Long\") scheduleID\n 14: optional i64 (js.type = \"Long\") expiryTimeNanos\n 15: optional i64 (js.type = \"Long\") createdTimeNanos\n}\n\nstruct TaskListInfo {\n 10: optional i16 kind // {Normal, Sticky}\n 12: optional i64 (js.type = \"Long\") ackLevel\n 14: optional i64 (js.type = \"Long\") expiryTimeNanos\n 16: optional i64 (js.type = \"Long\") lastUpdatedNanos\n}\n\nstruct TransferTaskInfo {\n 10: optional binary domainID\n 12: optional string workflowID\n 14: optional binary runID\n 16: optional i16 taskType\n 18: optional binary targetDomainID\n 20: optional string targetWorkflowID\n 22: optional binary targetRunID\n 24: optional string taskList\n 26: optional bool targetChildWorkflowOnly\n 28: optional i64 (js.type = \"Long\") scheduleID\n 30: optional i64 (js.type = \"Long\") version\n 32: optional i64 (js.type = \"Long\") visibilityTimestampNanos\n}\n\nstruct TimerTaskInfo {\n 10: optional binary domainID\n 12: optional string workflowID\n 14: optional binary runID\n 16: optional i16 taskType\n 18: optional i16 timeoutType\n 20: optional i64 (js.type = \"Long\") version\n 22: optional i64 (js.type = \"Long\") scheduleAttempt\n 24: optional i64 (js.type = \"Long\") eventID\n}\n\nstruct ReplicationTaskInfo {\n 10: optional binary domainID\n 12: optional string workflowID\n 14: optional binary runID\n 16: optional i16 taskType\n 18: optional i64 (js.type = \"Long\") version\n 20: optional i64 (js.type = \"Long\") firstEventID\n 22: optional i64 (js.type = \"Long\") nextEventID\n 24: optional i64 (js.type = \"Long\") scheduledID\n 26: optional i32 eventStoreVersion\n 28: optional i32 newRunEventStoreVersion\n 30: optional binary branch_token\n 32: optional map lastReplicationInfo\n 34: optional binary newRunBranchToken\n 36: optional bool resetWorkflow\n}" diff --git a/.gen/go/sqlblobs/types.go b/.gen/go/sqlblobs/types.go index 3a5d2f80376..cde975da586 100644 --- a/.gen/go/sqlblobs/types.go +++ b/.gen/go/sqlblobs/types.go @@ -5382,10 +5382,11 @@ func (v *SignalInfo) IsSetControl() bool { } type TaskInfo struct { - WorkflowID *string `json:"workflowID,omitempty"` - RunID []byte `json:"runID,omitempty"` - ScheduleID *int64 `json:"scheduleID,omitempty"` - ExpiryTimeNanos *int64 `json:"expiryTimeNanos,omitempty"` + WorkflowID *string `json:"workflowID,omitempty"` + RunID []byte `json:"runID,omitempty"` + ScheduleID *int64 `json:"scheduleID,omitempty"` + ExpiryTimeNanos *int64 `json:"expiryTimeNanos,omitempty"` + CreatedTimeNanos *int64 `json:"createdTimeNanos,omitempty"` } // ToWire translates a TaskInfo struct into a Thrift-level intermediate @@ -5405,7 +5406,7 @@ type TaskInfo struct { // } func (v *TaskInfo) ToWire() (wire.Value, error) { var ( - fields [4]wire.Field + fields [5]wire.Field i int = 0 w wire.Value err error @@ -5443,6 +5444,14 @@ func (v *TaskInfo) ToWire() (wire.Value, error) { fields[i] = wire.Field{ID: 14, Value: w} i++ } + if v.CreatedTimeNanos != nil { + w, err = wire.NewValueI64(*(v.CreatedTimeNanos)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 15, Value: w} + i++ + } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } @@ -5506,6 +5515,16 @@ func (v *TaskInfo) FromWire(w wire.Value) error { return err } + } + case 15: + if field.Value.Type() == wire.TI64 { + var x int64 + x, err = field.Value.GetI64(), error(nil) + v.CreatedTimeNanos = &x + if err != nil { + return err + } + } } } @@ -5520,7 +5539,7 @@ func (v *TaskInfo) String() string { return "" } - var fields [4]string + var fields [5]string i := 0 if v.WorkflowID != nil { fields[i] = fmt.Sprintf("WorkflowID: %v", *(v.WorkflowID)) @@ -5538,6 +5557,10 @@ func (v *TaskInfo) String() string { fields[i] = fmt.Sprintf("ExpiryTimeNanos: %v", *(v.ExpiryTimeNanos)) i++ } + if v.CreatedTimeNanos != nil { + fields[i] = fmt.Sprintf("CreatedTimeNanos: %v", *(v.CreatedTimeNanos)) + i++ + } return fmt.Sprintf("TaskInfo{%v}", strings.Join(fields[:i], ", ")) } @@ -5564,6 +5587,9 @@ func (v *TaskInfo) Equals(rhs *TaskInfo) bool { if !_I64_EqualsPtr(v.ExpiryTimeNanos, rhs.ExpiryTimeNanos) { return false } + if !_I64_EqualsPtr(v.CreatedTimeNanos, rhs.CreatedTimeNanos) { + return false + } return true } @@ -5586,6 +5612,9 @@ func (v *TaskInfo) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) { if v.ExpiryTimeNanos != nil { enc.AddInt64("expiryTimeNanos", *v.ExpiryTimeNanos) } + if v.CreatedTimeNanos != nil { + enc.AddInt64("createdTimeNanos", *v.CreatedTimeNanos) + } return err } @@ -5649,6 +5678,21 @@ func (v *TaskInfo) IsSetExpiryTimeNanos() bool { return v != nil && v.ExpiryTimeNanos != nil } +// GetCreatedTimeNanos returns the value of CreatedTimeNanos if it is set or its +// zero value if it is unset. +func (v *TaskInfo) GetCreatedTimeNanos() (o int64) { + if v != nil && v.CreatedTimeNanos != nil { + return *v.CreatedTimeNanos + } + + return +} + +// IsSetCreatedTimeNanos returns true if CreatedTimeNanos is not nil. +func (v *TaskInfo) IsSetCreatedTimeNanos() bool { + return v != nil && v.CreatedTimeNanos != nil +} + type TaskListInfo struct { Kind *int16 `json:"kind,omitempty"` AckLevel *int64 `json:"ackLevel,omitempty"` diff --git a/common/metrics/defs.go b/common/metrics/defs.go index 4d128beef86..7da96d9ff09 100644 --- a/common/metrics/defs.go +++ b/common/metrics/defs.go @@ -1311,6 +1311,7 @@ const ( SyncThrottleCounter BufferThrottleCounter SyncMatchLatency + AsyncMatchLatency ExpiredTasksCounter NumMatchingMetrics @@ -1552,6 +1553,7 @@ var MetricDefs = map[ServiceIdx]map[int]metricDefinition{ BufferThrottleCounter: {metricName: "buffer_throttle_count"}, ExpiredTasksCounter: {metricName: "tasks_expired"}, SyncMatchLatency: {metricName: "syncmatch_latency", metricType: Timer}, + AsyncMatchLatency: {metricName: "asyncmatch_latency", metricType: Timer}, }, Worker: { ReplicatorMessages: {metricName: "replicator_messages"}, diff --git a/common/persistence/cassandra/cassandraPersistence.go b/common/persistence/cassandra/cassandraPersistence.go index fa26a316496..93959814492 100644 --- a/common/persistence/cassandra/cassandraPersistence.go +++ b/common/persistence/cassandra/cassandraPersistence.go @@ -333,7 +333,8 @@ const ( `domain_id: ?, ` + `workflow_id: ?, ` + `run_id: ?, ` + - `schedule_id: ?` + + `schedule_id: ?,` + + `created_time: ? ` + `}` templateCreateShardQuery = `INSERT INTO executions (` + @@ -2782,6 +2783,7 @@ func (d *cassandraPersistence) CreateTasks(request *p.CreateTasksRequest) (*p.Cr taskListType := request.TaskListInfo.TaskType taskListKind := request.TaskListInfo.Kind ackLevel := request.TaskListInfo.AckLevel + cqlNowTimestamp := p.UnixNanoToDBTimestamp(time.Now().UnixNano()) for _, task := range request.Tasks { scheduleID := task.Data.ScheduleID @@ -2795,7 +2797,8 @@ func (d *cassandraPersistence) CreateTasks(request *p.CreateTasksRequest) (*p.Cr domainID, task.Execution.GetWorkflowId(), task.Execution.GetRunId(), - scheduleID) + scheduleID, + cqlNowTimestamp) } else { batch.Query(templateCreateTaskWithTTLQuery, domainID, @@ -2807,6 +2810,7 @@ func (d *cassandraPersistence) CreateTasks(request *p.CreateTasksRequest) (*p.Cr task.Execution.GetWorkflowId(), task.Execution.GetRunId(), scheduleID, + cqlNowTimestamp, task.Data.ScheduleToStartTimeout) } } @@ -4313,6 +4317,8 @@ func createTaskInfo(result map[string]interface{}) *p.TaskInfo { info.RunID = v.(gocql.UUID).String() case "schedule_id": info.ScheduleID = v.(int64) + case "created_time": + info.CreatedTime = v.(time.Time) } } diff --git a/common/persistence/dataInterfaces.go b/common/persistence/dataInterfaces.go index 46ca61eedf4..dfec074afc9 100644 --- a/common/persistence/dataInterfaces.go +++ b/common/persistence/dataInterfaces.go @@ -361,6 +361,7 @@ type ( ScheduleID int64 ScheduleToStartTimeout int32 Expiry time.Time + CreatedTime time.Time } // Task is the generic interface for workflow tasks diff --git a/common/persistence/persistence-tests/matchingPersistenceTest.go b/common/persistence/persistence-tests/matchingPersistenceTest.go index 3831be4fdbd..553c8e317ee 100644 --- a/common/persistence/persistence-tests/matchingPersistenceTest.go +++ b/common/persistence/persistence-tests/matchingPersistenceTest.go @@ -103,6 +103,7 @@ func (s *MatchingPersistenceSuite) TestCreateTask() { s.Equal(*workflowExecution.WorkflowId, resp.Tasks[0].WorkflowID) s.Equal(*workflowExecution.RunId, resp.Tasks[0].RunID) s.Equal(sid, resp.Tasks[0].ScheduleID) + s.True(resp.Tasks[0].CreatedTime.UnixNano() > 0) if s.TaskMgr.GetName() != "cassandra" { // cassandra uses TTL and expiry isn't stored as part of task state s.True(time.Now().Before(resp.Tasks[0].Expiry)) diff --git a/common/persistence/sql/sqlTaskManager.go b/common/persistence/sql/sqlTaskManager.go index bc98a791ad9..be02742958f 100644 --- a/common/persistence/sql/sqlTaskManager.go +++ b/common/persistence/sql/sqlTaskManager.go @@ -331,10 +331,11 @@ func (m *sqlTaskManager) CreateTasks(request *persistence.CreateTasksRequest) (* expiryTime = time.Now().Add(time.Second * time.Duration(v.Data.ScheduleToStartTimeout)) } blob, err := taskInfoToBlob(&sqlblobs.TaskInfo{ - WorkflowID: &v.Data.WorkflowID, - RunID: sqldb.MustParseUUID(v.Data.RunID), - ScheduleID: &v.Data.ScheduleID, - ExpiryTimeNanos: common.Int64Ptr(expiryTime.UnixNano()), + WorkflowID: &v.Data.WorkflowID, + RunID: sqldb.MustParseUUID(v.Data.RunID), + ScheduleID: &v.Data.ScheduleID, + ExpiryTimeNanos: common.Int64Ptr(expiryTime.UnixNano()), + CreatedTimeNanos: common.Int64Ptr(time.Now().UnixNano()), }) if err != nil { return nil, err @@ -390,12 +391,13 @@ func (m *sqlTaskManager) GetTasks(request *persistence.GetTasksRequest) (*persis return nil, err } tasks[i] = &persistence.TaskInfo{ - DomainID: request.DomainID, - WorkflowID: info.GetWorkflowID(), - RunID: sqldb.UUID(info.RunID).String(), - TaskID: v.TaskID, - ScheduleID: info.GetScheduleID(), - Expiry: time.Unix(0, info.GetExpiryTimeNanos()), + DomainID: request.DomainID, + WorkflowID: info.GetWorkflowID(), + RunID: sqldb.UUID(info.RunID).String(), + TaskID: v.TaskID, + ScheduleID: info.GetScheduleID(), + Expiry: time.Unix(0, info.GetExpiryTimeNanos()), + CreatedTime: time.Unix(0, info.GetCreatedTimeNanos()), } } diff --git a/idl/github.com/uber/cadence/sqlblobs.thrift b/idl/github.com/uber/cadence/sqlblobs.thrift index 356a01127d8..01020d300ca 100644 --- a/idl/github.com/uber/cadence/sqlblobs.thrift +++ b/idl/github.com/uber/cadence/sqlblobs.thrift @@ -195,6 +195,7 @@ struct TaskInfo { 12: optional binary runID 13: optional i64 (js.type = "Long") scheduleID 14: optional i64 (js.type = "Long") expiryTimeNanos + 15: optional i64 (js.type = "Long") createdTimeNanos } struct TaskListInfo { diff --git a/schema/cassandra/cadence/schema.cql b/schema/cassandra/cadence/schema.cql index c7610f50882..2400738e497 100644 --- a/schema/cassandra/cadence/schema.cql +++ b/schema/cassandra/cadence/schema.cql @@ -223,6 +223,7 @@ CREATE TYPE task ( workflow_id text, run_id uuid, schedule_id bigint, + created_time timestamp ); CREATE TYPE task_list ( diff --git a/schema/cassandra/cadence/versioned/v0.17/manifest.json b/schema/cassandra/cadence/versioned/v0.17/manifest.json index d1ded936464..8b58bc8b0e8 100644 --- a/schema/cassandra/cadence/versioned/v0.17/manifest.json +++ b/schema/cassandra/cadence/versioned/v0.17/manifest.json @@ -3,6 +3,7 @@ "MinCompatibleVersion": "0.17", "Description": "Added search attributes to execution", "SchemaUpdateCqlFiles": [ - "search_attr.cql" + "search_attr.cql", + "task_created_time.cql" ] } \ No newline at end of file diff --git a/schema/cassandra/cadence/versioned/v0.17/task_created_time.cql b/schema/cassandra/cadence/versioned/v0.17/task_created_time.cql new file mode 100644 index 00000000000..cdff2fd0cc8 --- /dev/null +++ b/schema/cassandra/cadence/versioned/v0.17/task_created_time.cql @@ -0,0 +1 @@ +ALTER TYPE task ADD created_time timestamp; \ No newline at end of file diff --git a/service/matching/matchingEngine.go b/service/matching/matchingEngine.go index 9392d1d7c35..c7a03b3990f 100644 --- a/service/matching/matchingEngine.go +++ b/service/matching/matchingEngine.go @@ -26,6 +26,7 @@ import ( "fmt" "math" "sync" + "time" "github.com/pborman/uuid" h "github.com/uber/cadence/.gen/go/history" @@ -232,6 +233,7 @@ func (e *matchingEngineImpl) AddDecisionTask(addRequest *m.AddDecisionTaskReques WorkflowID: addRequest.Execution.GetWorkflowId(), ScheduleID: addRequest.GetScheduleId(), ScheduleToStartTimeout: addRequest.GetScheduleToStartTimeoutSeconds(), + CreatedTime: time.Now(), } return tlMgr.AddTask(addRequest.Execution, taskInfo) } @@ -255,6 +257,7 @@ func (e *matchingEngineImpl) AddActivityTask(addRequest *m.AddActivityTaskReques WorkflowID: addRequest.Execution.GetWorkflowId(), ScheduleID: addRequest.GetScheduleId(), ScheduleToStartTimeout: addRequest.GetScheduleToStartTimeoutSeconds(), + CreatedTime: time.Now(), } return tlMgr.AddTask(addRequest.Execution, taskInfo) } @@ -618,6 +621,11 @@ func (e *matchingEngineImpl) createPollForDecisionTaskResponse(context *taskCont ScheduleAttempt: historyResponse.GetAttempt(), } token, _ = e.tokenSerializer.Serialize(taskoken) + if context.syncResponseCh == nil { + scope := domainTaggedMetricScope(e.domainCache, task.DomainID, e.metricsClient, metrics.MatchingPollForDecisionTaskScope) + scope.RecordTimer(metrics.AsyncMatchLatency, time.Since(task.CreatedTime)) + scope.Tagged(metrics.DomainAllTag()).RecordTimer(metrics.AsyncMatchLatency, time.Since(task.CreatedTime)) + } } response := common.CreateMatchingPollForDecisionTaskResponse(historyResponse, workflowExecutionPtr(context.workflowExecution), token) @@ -625,7 +633,6 @@ func (e *matchingEngineImpl) createPollForDecisionTaskResponse(context *taskCont response.Query = context.queryTaskInfo.queryRequest.QueryRequest.Query } response.BacklogCountHint = common.Int64Ptr(context.backlogCountHint) - return response } @@ -642,6 +649,11 @@ func (e *matchingEngineImpl) createPollForActivityTaskResponse(context *taskCont if attributes.ActivityId == nil { panic("ActivityTaskScheduledEventAttributes.ActivityID is not set") } + if context.syncResponseCh == nil { + scope := domainTaggedMetricScope(e.domainCache, task.DomainID, e.metricsClient, metrics.MatchingPollForActivityTaskScope) + scope.RecordTimer(metrics.AsyncMatchLatency, time.Since(task.CreatedTime)) + scope.Tagged(metrics.DomainAllTag()).RecordTimer(metrics.AsyncMatchLatency, time.Since(task.CreatedTime)) + } response := &workflow.PollForActivityTaskResponse{} response.ActivityId = attributes.ActivityId