Skip to content

Commit 925e64d

Browse files
authored
Add schedule id to pending activity info and pending decision info to history service (#6507)
* Add schedule id to pending activity info and pending decision info to history
1 parent 05b1609 commit 925e64d

File tree

16 files changed

+618
-458
lines changed

16 files changed

+618
-458
lines changed

.gen/go/shared/shared.go

+134-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.gen/proto/history/v1/service.pb.yarpc.go

+149-148
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.gen/proto/matching/v1/service.pb.yarpc.go

+149-148
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.gen/proto/shared/v1/history.pb.yarpc.go

+149-148
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/server/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ require (
4040
github.com/startreedata/pinot-client-go v0.2.0 // latest release supports pinot v0.12.0 which is also internal version
4141
github.com/stretchr/testify v1.8.3
4242
github.com/uber-go/tally v3.3.15+incompatible // indirect
43-
github.com/uber/cadence-idl v0.0.0-20241112184147-b527eebaaeaa
43+
github.com/uber/cadence-idl v0.0.0-20241118185545-0ff09166fc7c
4444
github.com/uber/ringpop-go v0.8.5 // indirect
4545
github.com/uber/tchannel-go v1.22.2 // indirect
4646
github.com/valyala/fastjson v1.4.1 // indirect

cmd/server/go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,8 @@ github.com/uber-go/tally v3.3.12+incompatible/go.mod h1:YDTIBxdXyOU/sCWilKB4bgyu
407407
github.com/uber-go/tally v3.3.15+incompatible h1:9hLSgNBP28CjIaDmAuRTq9qV+UZY+9PcvAkXO4nNMwg=
408408
github.com/uber-go/tally v3.3.15+incompatible/go.mod h1:YDTIBxdXyOU/sCWilKB4bgyufu1cEi0jdVnRdxvjnmU=
409409
github.com/uber/cadence-idl v0.0.0-20211111101836-d6b70b60eb8c/go.mod h1:oyUK7GCNCRHCCyWyzifSzXpVrRYVBbAMHAzF5dXiKws=
410-
github.com/uber/cadence-idl v0.0.0-20241112184147-b527eebaaeaa h1:pi5AePVFxcQyMF3DqIzSXciZK7sOyZaNv//53tIl4tw=
411-
github.com/uber/cadence-idl v0.0.0-20241112184147-b527eebaaeaa/go.mod h1:oyUK7GCNCRHCCyWyzifSzXpVrRYVBbAMHAzF5dXiKws=
410+
github.com/uber/cadence-idl v0.0.0-20241118185545-0ff09166fc7c h1:sagx8l5XOlJWlwwflrxsxlYXgsgyr1Jpe2eXl7q5Vic=
411+
github.com/uber/cadence-idl v0.0.0-20241118185545-0ff09166fc7c/go.mod h1:oyUK7GCNCRHCCyWyzifSzXpVrRYVBbAMHAzF5dXiKws=
412412
github.com/uber/jaeger-client-go v2.22.1+incompatible h1:NHcubEkVbahf9t3p75TOCR83gdUHXjRJvjoBh1yACsM=
413413
github.com/uber/jaeger-client-go v2.22.1+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk=
414414
github.com/uber/jaeger-lib v2.2.0+incompatible h1:MxZXOiR2JuoANZ3J6DE/U0kSFv/eJ/GfSYVCjK7dyaw=

common/types/mapper/proto/api.go

+4
Original file line numberDiff line numberDiff line change
@@ -1997,6 +1997,7 @@ func FromPendingActivityInfo(t *types.PendingActivityInfo) *apiv1.PendingActivit
19971997
LastFailure: FromFailure(t.LastFailureReason, t.LastFailureDetails),
19981998
LastWorkerIdentity: t.LastWorkerIdentity,
19991999
StartedWorkerIdentity: t.StartedWorkerIdentity,
2000+
ScheduleId: t.ScheduleID,
20002001
}
20012002
}
20022003

@@ -2019,6 +2020,7 @@ func ToPendingActivityInfo(t *apiv1.PendingActivityInfo) *types.PendingActivityI
20192020
LastFailureDetails: ToFailureDetails(t.LastFailure),
20202021
LastWorkerIdentity: t.LastWorkerIdentity,
20212022
StartedWorkerIdentity: t.StartedWorkerIdentity,
2023+
ScheduleID: t.ScheduleId,
20222024
}
20232025
}
20242026

@@ -2088,6 +2090,7 @@ func FromPendingDecisionInfo(t *types.PendingDecisionInfo) *apiv1.PendingDecisio
20882090
StartedTime: unixNanoToTime(t.StartedTimestamp),
20892091
Attempt: int32(t.Attempt),
20902092
OriginalScheduledTime: unixNanoToTime(t.OriginalScheduledTimestamp),
2093+
ScheduleId: t.ScheduleID,
20912094
}
20922095
}
20932096

@@ -2101,6 +2104,7 @@ func ToPendingDecisionInfo(t *apiv1.PendingDecisionInfo) *types.PendingDecisionI
21012104
StartedTimestamp: timeToUnixNano(t.StartedTime),
21022105
Attempt: int64(t.Attempt),
21032106
OriginalScheduledTimestamp: timeToUnixNano(t.OriginalScheduledTime),
2107+
ScheduleID: t.ScheduleId,
21042108
}
21052109
}
21062110

common/types/mapper/thrift/shared.go

+4
Original file line numberDiff line numberDiff line change
@@ -3383,6 +3383,7 @@ func FromPendingActivityInfo(t *types.PendingActivityInfo) *shared.PendingActivi
33833383
LastWorkerIdentity: &t.LastWorkerIdentity,
33843384
LastFailureDetails: t.LastFailureDetails,
33853385
StartedWorkerIdentity: &t.StartedWorkerIdentity,
3386+
ScheduleID: &t.ScheduleID,
33863387
}
33873388
}
33883389

@@ -3406,6 +3407,7 @@ func ToPendingActivityInfo(t *shared.PendingActivityInfo) *types.PendingActivity
34063407
LastWorkerIdentity: t.GetLastWorkerIdentity(),
34073408
LastFailureDetails: t.LastFailureDetails,
34083409
StartedWorkerIdentity: t.GetStartedWorkerIdentity(),
3410+
ScheduleID: t.GetScheduleID(),
34093411
}
34103412
}
34113413

@@ -3488,6 +3490,7 @@ func FromPendingDecisionInfo(t *types.PendingDecisionInfo) *shared.PendingDecisi
34883490
StartedTimestamp: t.StartedTimestamp,
34893491
Attempt: &t.Attempt,
34903492
OriginalScheduledTimestamp: t.OriginalScheduledTimestamp,
3493+
ScheduleID: &t.ScheduleID,
34913494
}
34923495
}
34933496

@@ -3502,6 +3505,7 @@ func ToPendingDecisionInfo(t *shared.PendingDecisionInfo) *types.PendingDecision
35023505
StartedTimestamp: t.StartedTimestamp,
35033506
Attempt: t.GetAttempt(),
35043507
OriginalScheduledTimestamp: t.OriginalScheduledTimestamp,
3508+
ScheduleID: t.GetScheduleID(),
35053509
}
35063510
}
35073511

common/types/shared.go

+10
Original file line numberDiff line numberDiff line change
@@ -3604,6 +3604,7 @@ type PendingActivityInfo struct {
36043604
StartedWorkerIdentity string `json:"startedWorkerIdentity,omitempty"`
36053605
LastWorkerIdentity string `json:"lastWorkerIdentity,omitempty"`
36063606
LastFailureDetails []byte `json:"lastFailureDetails,omitempty"`
3607+
ScheduleID int64 `json:"scheduleID,omitempty"`
36073608
}
36083609

36093610
// GetActivityID is an internal getter (TBD...)
@@ -3686,6 +3687,14 @@ func (v *PendingActivityInfo) GetLastFailureDetails() (o []byte) {
36863687
return
36873688
}
36883689

3690+
// GetScheduleID is an internal getter (TBD...)
3691+
func (v *PendingActivityInfo) GetScheduleID() (o int64) {
3692+
if v != nil {
3693+
return v.ScheduleID
3694+
}
3695+
return
3696+
}
3697+
36893698
// PendingActivityState is an internal type (TBD...)
36903699
type PendingActivityState int32
36913700

@@ -3793,6 +3802,7 @@ type PendingDecisionInfo struct {
37933802
StartedTimestamp *int64 `json:"startedTimestamp,omitempty"`
37943803
Attempt int64 `json:"attempt,omitempty"`
37953804
OriginalScheduledTimestamp *int64 `json:"originalScheduledTimestamp,omitempty"`
3805+
ScheduleID int64 `json:"scheduleID,omitempty"`
37963806
}
37973807

37983808
// PendingDecisionState is an internal type (TBD...)

common/types/testdata/common.go

+3
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ const (
6060
FeatureFlag = "FeatureFlag"
6161

6262
Attempt = 2
63+
ScheduleID = 5
6364
PageSize = 10
6465
HistoryLength = 20
6566
BacklogCountHint = 30
@@ -416,6 +417,7 @@ var (
416417
LastWorkerIdentity: Identity,
417418
LastFailureDetails: FailureDetails,
418419
StartedWorkerIdentity: Identity,
420+
ScheduleID: ScheduleID,
419421
}
420422
PendingActivityInfoArray = []*types.PendingActivityInfo{
421423
&PendingActivityInfo,
@@ -437,5 +439,6 @@ var (
437439
StartedTimestamp: &Timestamp2,
438440
Attempt: Attempt,
439441
OriginalScheduledTimestamp: &Timestamp3,
442+
ScheduleID: ScheduleID,
440443
}
441444
)

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ require (
4040
github.com/startreedata/pinot-client-go v0.2.0 // latest release supports pinot v0.12.0 which is also internal version
4141
github.com/stretchr/testify v1.8.3
4242
github.com/uber-go/tally v3.3.15+incompatible
43-
github.com/uber/cadence-idl v0.0.0-20241112184147-b527eebaaeaa
43+
github.com/uber/cadence-idl v0.0.0-20241118185545-0ff09166fc7c
4444
github.com/uber/ringpop-go v0.8.5
4545
github.com/uber/tchannel-go v1.22.2
4646
github.com/urfave/cli/v2 v2.27.4

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,8 @@ github.com/uber-go/tally v3.3.12+incompatible/go.mod h1:YDTIBxdXyOU/sCWilKB4bgyu
445445
github.com/uber-go/tally v3.3.15+incompatible h1:9hLSgNBP28CjIaDmAuRTq9qV+UZY+9PcvAkXO4nNMwg=
446446
github.com/uber-go/tally v3.3.15+incompatible/go.mod h1:YDTIBxdXyOU/sCWilKB4bgyufu1cEi0jdVnRdxvjnmU=
447447
github.com/uber/cadence-idl v0.0.0-20211111101836-d6b70b60eb8c/go.mod h1:oyUK7GCNCRHCCyWyzifSzXpVrRYVBbAMHAzF5dXiKws=
448-
github.com/uber/cadence-idl v0.0.0-20241112184147-b527eebaaeaa h1:pi5AePVFxcQyMF3DqIzSXciZK7sOyZaNv//53tIl4tw=
449-
github.com/uber/cadence-idl v0.0.0-20241112184147-b527eebaaeaa/go.mod h1:oyUK7GCNCRHCCyWyzifSzXpVrRYVBbAMHAzF5dXiKws=
448+
github.com/uber/cadence-idl v0.0.0-20241118185545-0ff09166fc7c h1:sagx8l5XOlJWlwwflrxsxlYXgsgyr1Jpe2eXl7q5Vic=
449+
github.com/uber/cadence-idl v0.0.0-20241118185545-0ff09166fc7c/go.mod h1:oyUK7GCNCRHCCyWyzifSzXpVrRYVBbAMHAzF5dXiKws=
450450
github.com/uber/jaeger-client-go v2.22.1+incompatible h1:NHcubEkVbahf9t3p75TOCR83gdUHXjRJvjoBh1yACsM=
451451
github.com/uber/jaeger-client-go v2.22.1+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk=
452452
github.com/uber/jaeger-lib v2.2.0+incompatible h1:MxZXOiR2JuoANZ3J6DE/U0kSFv/eJ/GfSYVCjK7dyaw=

idls

Submodule idls updated from b527eeb to 0ff0916

service/history/engine/engineimpl/describe_workflow_execution.go

+2
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ func (e *historyEngineImpl) DescribeWorkflowExecution(
123123
for _, ai := range mutableState.GetPendingActivityInfos() {
124124
p := &types.PendingActivityInfo{
125125
ActivityID: ai.ActivityID,
126+
ScheduleID: ai.ScheduleID,
126127
}
127128
state := types.PendingActivityStateScheduled
128129
if ai.CancelRequested {
@@ -201,6 +202,7 @@ func (e *historyEngineImpl) DescribeWorkflowExecution(
201202
ScheduledTimestamp: common.Int64Ptr(di.ScheduledTimestamp),
202203
Attempt: di.Attempt,
203204
OriginalScheduledTimestamp: common.Int64Ptr(di.OriginalScheduledTimestamp),
205+
ScheduleID: di.ScheduleID,
204206
}
205207
if di.StartedID != common.EmptyEventID {
206208
pendingDecision.State = types.PendingDecisionStateStarted.Ptr()

service/history/engine/engineimpl/describe_workflow_execution_test.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ func TestDescribeWorkflowExecution(t *testing.T) {
104104
StartedWorkerIdentity: "StartedWorkerIdentity",
105105
LastWorkerIdentity: "LastWorkerIdentity",
106106
LastFailureDetails: []byte("failure details"),
107+
ScheduleID: 1,
107108
}
108109
child1 := &types.PendingChildExecutionInfo{
109110
Domain: childDomainID,
@@ -117,7 +118,7 @@ func TestDescribeWorkflowExecution(t *testing.T) {
117118
State: &persistence.WorkflowMutableState{
118119
ActivityInfos: map[int64]*persistence.ActivityInfo{
119120
1: {
120-
ScheduleID: 1,
121+
ScheduleID: activity1.ScheduleID,
121122
ScheduledEvent: &types.HistoryEvent{
122123
ID: 1,
123124
ActivityTaskScheduledEventAttributes: &types.ActivityTaskScheduledEventAttributes{
@@ -259,6 +260,7 @@ func TestDescribeWorkflowExecution(t *testing.T) {
259260
StartedTimestamp: common.Int64Ptr(pendingDecisionStartedTimestamp),
260261
Attempt: pendingDecisionAttempt,
261262
OriginalScheduledTimestamp: common.Int64Ptr(pendingDecisionOriginalScheduledTime),
263+
ScheduleID: pendingDecisionScheduleID,
262264
},
263265
}, result)
264266
assert.Nil(t, err)

tools/cli/workflow_commands.go

+4
Original file line numberDiff line numberDiff line change
@@ -1154,6 +1154,7 @@ type pendingActivityInfo struct {
11541154
LastFailureReason *string `json:",omitempty"`
11551155
LastWorkerIdentity string `json:",omitempty"`
11561156
LastFailureDetails *string `json:",omitempty"` // change from []byte
1157+
ScheduleID int64 `json:",omitempty"`
11571158
}
11581159

11591160
type pendingDecisionInfo struct {
@@ -1162,6 +1163,7 @@ type pendingDecisionInfo struct {
11621163
ScheduledTimestamp *string `json:",omitempty"` // change from *int64
11631164
StartedTimestamp *string `json:",omitempty"` // change from *int64
11641165
Attempt int64 `json:",omitempty"`
1166+
ScheduleID int64 `json:",omitempty"`
11651167
}
11661168

11671169
func convertDescribeWorkflowExecutionResponse(resp *types.DescribeWorkflowExecutionResponse,
@@ -1202,6 +1204,7 @@ func convertDescribeWorkflowExecutionResponse(resp *types.DescribeWorkflowExecut
12021204
ExpirationTimestamp: timestampPtrToStringPtr(pa.ExpirationTimestamp, false),
12031205
LastFailureReason: pa.LastFailureReason,
12041206
LastWorkerIdentity: pa.LastWorkerIdentity,
1207+
ScheduleID: pa.ScheduleID,
12051208
}
12061209
if pa.HeartbeatDetails != nil {
12071210
tmpAct.HeartbeatDetails = common.StringPtr(string(pa.HeartbeatDetails))
@@ -1219,6 +1222,7 @@ func convertDescribeWorkflowExecutionResponse(resp *types.DescribeWorkflowExecut
12191222
ScheduledTimestamp: timestampPtrToStringPtr(resp.PendingDecision.ScheduledTimestamp, false),
12201223
StartedTimestamp: timestampPtrToStringPtr(resp.PendingDecision.StartedTimestamp, false),
12211224
Attempt: resp.PendingDecision.Attempt,
1225+
ScheduleID: resp.PendingDecision.ScheduleID,
12221226
}
12231227
// TODO: Idea here is only display decision task original scheduled timestamp if user are
12241228
// using decision heartbeat. And we should be able to tell whether a decision task has heartbeat

0 commit comments

Comments
 (0)