Skip to content

Unify methods of history tasks in shard component #6868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions common/persistence/data_manager_interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,15 @@ type (
CurrentRunID string
}

// FailoverLevel contains corresponding start / end level
FailoverLevel struct {
StartTime time.Time
MinLevel HistoryTaskKey
CurrentLevel HistoryTaskKey
MaxLevel HistoryTaskKey
DomainIDs map[string]struct{}
}

// TransferTaskInfo describes a transfer task
TransferTaskInfo struct {
DomainID string
Expand Down
28 changes: 14 additions & 14 deletions service/history/decision/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func TestHandleDecisionTaskScheduled(t *testing.T) {
Times(1).
Return(&types.HistoryEvent{}, nil)
shardContext.EXPECT().GetShardID().Return(testShardID).Times(1)
shardContext.EXPECT().GenerateTransferTaskIDs(gomock.Any()).Times(1).Return([]int64{}, errors.New("some random error to avoid going too deep in call stack unrelated to this unit"))
shardContext.EXPECT().GenerateTaskIDs(gomock.Any()).Times(1).Return([]int64{}, errors.New("some random error to avoid going too deep in call stack unrelated to this unit"))
},
expectErr: true,
isfirstDecision: true,
Expand All @@ -222,7 +222,7 @@ func TestHandleDecisionTaskScheduled(t *testing.T) {
Times(1).
Return(&types.HistoryEvent{}, nil)
shardContext.EXPECT().GetShardID().Return(testShardID).Times(1)
shardContext.EXPECT().GenerateTransferTaskIDs(gomock.Any()).Times(1).Return([]int64{}, errors.New("some random error to avoid going too deep in call stack unrelated to this unit"))
shardContext.EXPECT().GenerateTaskIDs(gomock.Any()).Times(1).Return([]int64{}, errors.New("some random error to avoid going too deep in call stack unrelated to this unit"))
},
expectErr: true,
isfirstDecision: true,
Expand Down Expand Up @@ -301,7 +301,7 @@ func TestHandleDecisionTaskFailed(t *testing.T) {
}
h.tokenSerializer.(*common.MockTaskTokenSerializer).EXPECT().Deserialize(taskToken).Return(token, nil)
h.shard.(*shard.MockContext).EXPECT().GetEventsCache().Times(1).Return(events.NewMockCache(ctrl))
h.shard.(*shard.MockContext).EXPECT().GenerateTransferTaskIDs(gomock.Any()).Return([]int64{0}, nil)
h.shard.(*shard.MockContext).EXPECT().GenerateTaskIDs(gomock.Any()).Return([]int64{0}, nil)
h.shard.(*shard.MockContext).EXPECT().AppendHistoryV2Events(gomock.Any(), gomock.Any(), constants.TestDomainID, types.WorkflowExecution{
WorkflowID: constants.TestWorkflowID,
RunID: constants.TestRunID,
Expand Down Expand Up @@ -494,7 +494,7 @@ func TestHandleDecisionTaskStarted(t *testing.T) {
domainID: constants.TestDomainID,
expectCalls: func(ctrl *gomock.Controller, h *handlerImpl) {
h.shard.(*shard.MockContext).EXPECT().GetEventsCache().Times(1).Return(events.NewMockCache(ctrl))
h.shard.(*shard.MockContext).EXPECT().GenerateTransferTaskIDs(gomock.Any()).Times(1).Return([]int64{0}, nil)
h.shard.(*shard.MockContext).EXPECT().GenerateTaskIDs(gomock.Any()).Times(1).Return([]int64{0}, nil)
h.shard.(*shard.MockContext).EXPECT().
AppendHistoryV2Events(gomock.Any(), gomock.Any(), constants.TestDomainID, types.WorkflowExecution{WorkflowID: constants.TestWorkflowID, RunID: constants.TestRunID}).
Return(&persistence.AppendHistoryNodesResponse{}, nil)
Expand Down Expand Up @@ -639,8 +639,8 @@ func TestHandleDecisionTaskCompleted(t *testing.T) {
decisionHandler.shard.(*shard.MockContext).EXPECT().GetEventsCache().Times(1).Return(eventsCache)
eventsCache.EXPECT().PutEvent(constants.TestDomainID, constants.TestWorkflowID, constants.TestRunID, int64(1), gomock.Any())
decisionHandler.shard.(*shard.MockContext).EXPECT().GetShardID().Times(1).Return(testShardID)
decisionHandler.shard.(*shard.MockContext).EXPECT().GenerateTransferTaskIDs(4).Return([]int64{0, 1, 2, 3}, nil)
decisionHandler.shard.(*shard.MockContext).EXPECT().GenerateTransferTaskIDs(6).Return([]int64{0, 1, 2, 3, 4, 5}, nil)
decisionHandler.shard.(*shard.MockContext).EXPECT().GenerateTaskIDs(4).Return([]int64{0, 1, 2, 3}, nil)
decisionHandler.shard.(*shard.MockContext).EXPECT().GenerateTaskIDs(6).Return([]int64{0, 1, 2, 3, 4, 5}, nil)
decisionHandler.shard.(*shard.MockContext).EXPECT().AppendHistoryV2Events(gomock.Any(), gomock.Any(), constants.TestDomainID, types.WorkflowExecution{
WorkflowID: constants.TestWorkflowID,
RunID: constants.TestRunID,
Expand Down Expand Up @@ -769,7 +769,7 @@ func TestHandleDecisionTaskCompleted(t *testing.T) {
eventsCache := events.NewMockCache(ctrl)
decisionHandler.shard.(*shard.MockContext).EXPECT().GetEventsCache().Times(1).Return(eventsCache)
decisionHandler.shard.(*shard.MockContext).EXPECT().GetShardID().Times(1).Return(testShardID)
decisionHandler.shard.(*shard.MockContext).EXPECT().GenerateTransferTaskIDs(1).Return([]int64{0}, nil)
decisionHandler.shard.(*shard.MockContext).EXPECT().GenerateTaskIDs(1).Return([]int64{0}, nil)
decisionHandler.shard.(*shard.MockContext).EXPECT().AppendHistoryV2Events(gomock.Any(), gomock.Any(), constants.TestDomainID, types.WorkflowExecution{
WorkflowID: constants.TestWorkflowID,
RunID: constants.TestRunID,
Expand Down Expand Up @@ -822,7 +822,7 @@ func TestHandleDecisionTaskCompleted(t *testing.T) {
eventsCache.EXPECT().GetEvent(context.Background(), testShardID, constants.TestDomainID, constants.TestWorkflowID, constants.TestRunID, commonconstants.FirstEventID, commonconstants.FirstEventID, nil).Return(&types.HistoryEvent{}, nil)
eventsCache.EXPECT().PutEvent(constants.TestDomainID, constants.TestWorkflowID, gomock.Any(), int64(1), gomock.Any()).Times(2)
decisionHandler.shard.(*shard.MockContext).EXPECT().GetShardID().Times(1).Return(testShardID)
decisionHandler.shard.(*shard.MockContext).EXPECT().GenerateTransferTaskIDs(2).Times(1).Return([]int64{0, 1}, nil)
decisionHandler.shard.(*shard.MockContext).EXPECT().GenerateTaskIDs(2).Times(1).Return([]int64{0, 1}, nil)
decisionHandler.shard.(*shard.MockContext).EXPECT().AppendHistoryV2Events(gomock.Any(), gomock.Any(), constants.TestDomainID, gomock.Any()).Return(nil, &persistence.TransactionSizeLimitError{Msg: fmt.Sprintf("transaction size exceeds limit")})
decisionHandler.shard.(*shard.MockContext).EXPECT().GetExecutionManager().Times(1)
},
Expand Down Expand Up @@ -863,7 +863,7 @@ func TestHandleDecisionTaskCompleted(t *testing.T) {
}, nil).Times(3)
eventsCache.EXPECT().PutEvent(constants.TestDomainID, constants.TestWorkflowID, gomock.Any(), int64(1), gomock.Any()).Times(2)
decisionHandler.shard.(*shard.MockContext).EXPECT().GetShardID().Times(3).Return(testShardID)
decisionHandler.shard.(*shard.MockContext).EXPECT().GenerateTransferTaskIDs(2).Times(1).Return([]int64{0, 1}, nil)
decisionHandler.shard.(*shard.MockContext).EXPECT().GenerateTaskIDs(2).Times(1).Return([]int64{0, 1}, nil)
decisionHandler.shard.(*shard.MockContext).EXPECT().AppendHistoryV2Events(gomock.Any(), gomock.Any(), constants.TestDomainID, gomock.Any()).Return(nil, execution.NewConflictError(new(testing.T), errors.New("some random conflict error")))
decisionHandler.shard.(*shard.MockContext).EXPECT().GetExecutionManager().Times(1)
},
Expand Down Expand Up @@ -904,7 +904,7 @@ func TestHandleDecisionTaskCompleted(t *testing.T) {
}, nil).Times(3)
eventsCache.EXPECT().PutEvent(constants.TestDomainID, constants.TestWorkflowID, gomock.Any(), int64(1), gomock.Any()).Times(2)
decisionHandler.shard.(*shard.MockContext).EXPECT().GetShardID().Times(3).Return(testShardID)
decisionHandler.shard.(*shard.MockContext).EXPECT().GenerateTransferTaskIDs(2).Times(1).Return([]int64{0, 1}, nil)
decisionHandler.shard.(*shard.MockContext).EXPECT().GenerateTaskIDs(2).Times(1).Return([]int64{0, 1}, nil)
decisionHandler.shard.(*shard.MockContext).EXPECT().AppendHistoryV2Events(gomock.Any(), gomock.Any(), constants.TestDomainID, gomock.Any()).Return(nil, &persistence.TransactionSizeLimitError{Msg: fmt.Sprintf("transaction size exceeds limit")})
decisionHandler.shard.(*shard.MockContext).EXPECT().GetExecutionManager().Times(1)
firstGetWfExecutionCall := decisionHandler.shard.(*shard.MockContext).EXPECT().GetWorkflowExecution(context.Background(), gomock.Any()).
Expand Down Expand Up @@ -955,8 +955,8 @@ func TestHandleDecisionTaskCompleted(t *testing.T) {
}, nil).Times(3)
eventsCache.EXPECT().PutEvent(constants.TestDomainID, constants.TestWorkflowID, gomock.Any(), int64(1), gomock.Any()).Times(3)
decisionHandler.shard.(*shard.MockContext).EXPECT().GetShardID().Times(3).Return(testShardID)
decisionHandler.shard.(*shard.MockContext).EXPECT().GenerateTransferTaskIDs(2).Times(2).Return([]int64{0, 1}, nil)
decisionHandler.shard.(*shard.MockContext).EXPECT().GenerateTransferTaskIDs(1).Times(1).Return([]int64{0}, nil)
decisionHandler.shard.(*shard.MockContext).EXPECT().GenerateTaskIDs(2).Times(2).Return([]int64{0, 1}, nil)
decisionHandler.shard.(*shard.MockContext).EXPECT().GenerateTaskIDs(1).Times(1).Return([]int64{0}, nil)
decisionHandler.shard.(*shard.MockContext).EXPECT().AppendHistoryV2Events(gomock.Any(), gomock.Any(), constants.TestDomainID, gomock.Any()).Return(nil, &persistence.TransactionSizeLimitError{Msg: fmt.Sprintf("transaction size exceeds limit")})
decisionHandler.shard.(*shard.MockContext).EXPECT().AppendHistoryV2Events(gomock.Any(), gomock.Any(), constants.TestDomainID, gomock.Any()).Return(&persistence.AppendHistoryNodesResponse{}, nil)
decisionHandler.shard.(*shard.MockContext).EXPECT().GetExecutionManager().Times(1)
Expand Down Expand Up @@ -999,7 +999,7 @@ func TestHandleDecisionTaskCompleted(t *testing.T) {
eventsCache := events.NewMockCache(ctrl)
decisionHandler.shard.(*shard.MockContext).EXPECT().GetEventsCache().Times(3).Return(eventsCache)
eventsCache.EXPECT().PutEvent(constants.TestDomainID, constants.TestWorkflowID, constants.TestRunID, int64(0), gomock.Any())
decisionHandler.shard.(*shard.MockContext).EXPECT().GenerateTransferTaskIDs(1).Return([]int64{0}, nil)
decisionHandler.shard.(*shard.MockContext).EXPECT().GenerateTaskIDs(1).Return([]int64{0}, nil)
decisionHandler.shard.(*shard.MockContext).EXPECT().AppendHistoryV2Events(gomock.Any(), gomock.Any(), constants.TestDomainID, gomock.Any()).Return(nil, errors.New("some error updating continue as new info"))
domainEntry := cache.NewLocalDomainCacheEntryForTest(
&persistence.DomainInfo{ID: constants.TestDomainID, Name: constants.TestDomainName},
Expand Down Expand Up @@ -1146,7 +1146,7 @@ func TestHandleDecisionTaskCompleted(t *testing.T) {
decisionHandler.tokenSerializer.(*common.MockTaskTokenSerializer).EXPECT().Deserialize(serializedTestToken).Return(deserializedTestToken, nil)
decisionHandler.shard.(*shard.MockContext).EXPECT().GetEventsCache().Times(1).Return(events.NewMockCache(ctrl))
decisionHandler.shard.(*shard.MockContext).EXPECT().GetShardID().Times(1).Return(testShardID)
decisionHandler.shard.(*shard.MockContext).EXPECT().GenerateTransferTaskIDs(3).Return([]int64{0, 1, 2}, nil)
decisionHandler.shard.(*shard.MockContext).EXPECT().GenerateTaskIDs(3).Return([]int64{0, 1, 2}, nil)
decisionHandler.shard.(*shard.MockContext).EXPECT().AppendHistoryV2Events(gomock.Any(), gomock.Any(), constants.TestDomainID, types.WorkflowExecution{
WorkflowID: constants.TestWorkflowID,
RunID: constants.TestRunID,
Expand Down
4 changes: 2 additions & 2 deletions service/history/execution/mutable_state_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ func (e *mutableStateBuilder) assignTaskIDToEvents() error {
// first transient events
numTaskIDs := len(e.hBuilder.transientHistory)
if numTaskIDs > 0 {
taskIDs, err := e.shard.GenerateTransferTaskIDs(numTaskIDs)
taskIDs, err := e.shard.GenerateTaskIDs(numTaskIDs)
if err != nil {
return err
}
Expand All @@ -815,7 +815,7 @@ func (e *mutableStateBuilder) assignTaskIDToEvents() error {
// then normal events
numTaskIDs = len(e.hBuilder.history)
if numTaskIDs > 0 {
taskIDs, err := e.shard.GenerateTransferTaskIDs(numTaskIDs)
taskIDs, err := e.shard.GenerateTaskIDs(numTaskIDs)
if err != nil {
return err
}
Expand Down
14 changes: 7 additions & 7 deletions service/history/execution/mutable_state_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3139,7 +3139,7 @@ func TestAssignTaskIDToTransientHistoryEvents(t *testing.T) {
},
taskID: 123,
shardContextExpectations: func(mockCache *events.MockCache, shardContext *shardCtx.MockContext, mockDomainCache *cache.MockDomainCache) {
shardContext.EXPECT().GenerateTransferTaskIDs(1).Return([]int64{123}, nil).Times(1)
shardContext.EXPECT().GenerateTaskIDs(1).Return([]int64{123}, nil).Times(1)
},
expectedEvents: []*types.HistoryEvent{
{
Expand All @@ -3164,7 +3164,7 @@ func TestAssignTaskIDToTransientHistoryEvents(t *testing.T) {
},
taskID: 456,
shardContextExpectations: func(mockCache *events.MockCache, shardContext *shardCtx.MockContext, mockDomainCache *cache.MockDomainCache) {
shardContext.EXPECT().GenerateTransferTaskIDs(2).Return([]int64{123, 124}, nil).Times(1)
shardContext.EXPECT().GenerateTaskIDs(2).Return([]int64{123, 124}, nil).Times(1)
},
expectedEvents: []*types.HistoryEvent{
{
Expand Down Expand Up @@ -3196,7 +3196,7 @@ func TestAssignTaskIDToTransientHistoryEvents(t *testing.T) {
},
taskID: 456,
shardContextExpectations: func(mockCache *events.MockCache, shardContext *shardCtx.MockContext, mockDomainCache *cache.MockDomainCache) {
shardContext.EXPECT().GenerateTransferTaskIDs(1).Return(nil, assert.AnError).Times(1)
shardContext.EXPECT().GenerateTaskIDs(1).Return(nil, assert.AnError).Times(1)
},
expectedEvents: []*types.HistoryEvent{
{
Expand Down Expand Up @@ -3252,7 +3252,7 @@ func TestAssignTaskIDToHistoryEvents(t *testing.T) {
},
taskID: 123,
shardContextExpectations: func(mockCache *events.MockCache, shardContext *shardCtx.MockContext, mockDomainCache *cache.MockDomainCache) {
shardContext.EXPECT().GenerateTransferTaskIDs(1).Return([]int64{123}, nil).Times(1)
shardContext.EXPECT().GenerateTaskIDs(1).Return([]int64{123}, nil).Times(1)
},
expectedEvents: []*types.HistoryEvent{
{
Expand All @@ -3277,7 +3277,7 @@ func TestAssignTaskIDToHistoryEvents(t *testing.T) {
},
taskID: 456,
shardContextExpectations: func(mockCache *events.MockCache, shardContext *shardCtx.MockContext, mockDomainCache *cache.MockDomainCache) {
shardContext.EXPECT().GenerateTransferTaskIDs(2).Return([]int64{123, 124}, nil).Times(1)
shardContext.EXPECT().GenerateTaskIDs(2).Return([]int64{123, 124}, nil).Times(1)
},
expectedEvents: []*types.HistoryEvent{
{
Expand Down Expand Up @@ -3309,7 +3309,7 @@ func TestAssignTaskIDToHistoryEvents(t *testing.T) {
},
taskID: 456,
shardContextExpectations: func(mockCache *events.MockCache, shardContext *shardCtx.MockContext, mockDomainCache *cache.MockDomainCache) {
shardContext.EXPECT().GenerateTransferTaskIDs(1).Return(nil, assert.AnError).Times(1)
shardContext.EXPECT().GenerateTaskIDs(1).Return(nil, assert.AnError).Times(1)
},
expectedEvents: []*types.HistoryEvent{
{
Expand Down Expand Up @@ -3535,7 +3535,7 @@ func TestCloseTransactionAsMutation(t *testing.T) {
MaximumBufferedEventsBatch: func(...dynamicproperties.FilterOption) int { return 100 },
}).Times(3)

shardContext.EXPECT().GenerateTransferTaskIDs(1).Return([]int64{123}, nil).Times(1)
shardContext.EXPECT().GenerateTaskIDs(1).Return([]int64{123}, nil).Times(1)
shardContext.EXPECT().GetDomainCache().Return(mockDomainCache).Times(1)
mockDomainCache.EXPECT().GetDomainByID("some-domain-id").Return(mockDomain, nil)

Expand Down
4 changes: 3 additions & 1 deletion service/history/queue/timer_queue_active_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ func newTimerQueueActiveProcessor(
}

updateClusterAckLevel := func(ackLevel task.Key) error {
return shard.UpdateTimerClusterAckLevel(clusterName, ackLevel.(timerTaskKey).visibilityTimestamp)
return shard.UpdateQueueClusterAckLevel(persistence.HistoryTaskCategoryTimer, clusterName, persistence.HistoryTaskKey{
ScheduledTime: ackLevel.(timerTaskKey).visibilityTimestamp,
})
}

updateProcessingQueueStates := func(states []ProcessingQueueState) error {
Expand Down
26 changes: 18 additions & 8 deletions service/history/queue/timer_queue_failover_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,30 @@ func newTimerQueueFailoverProcessor(
}

updateClusterAckLevel := func(ackLevel task.Key) error {
return shardContext.UpdateTimerFailoverLevel(
return shardContext.UpdateFailoverLevel(
persistence.HistoryTaskCategoryTimer,
failoverUUID,
shard.TimerFailoverLevel{
StartTime: failoverStartTime,
MinLevel: minLevel,
CurrentLevel: ackLevel.(timerTaskKey).visibilityTimestamp,
MaxLevel: maxLevel,
DomainIDs: domainIDs,
persistence.FailoverLevel{
StartTime: failoverStartTime,
MinLevel: persistence.HistoryTaskKey{
ScheduledTime: minLevel,
},
CurrentLevel: persistence.HistoryTaskKey{
ScheduledTime: ackLevel.(timerTaskKey).visibilityTimestamp,
},
MaxLevel: persistence.HistoryTaskKey{
ScheduledTime: maxLevel,
},
DomainIDs: domainIDs,
},
)
}

queueShutdown := func() error {
return shardContext.DeleteTimerFailoverLevel(failoverUUID)
return shardContext.DeleteFailoverLevel(
persistence.HistoryTaskCategoryTimer,
failoverUUID,
)
}

processingQueueStates := []ProcessingQueueState{
Expand Down
16 changes: 9 additions & 7 deletions service/history/queue/timer_queue_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func NewTimerQueueProcessor(
status: common.DaemonStatusInitialized,
shutdownChan: make(chan struct{}),

ackLevel: shard.GetTimerAckLevel(),
ackLevel: shard.GetQueueAckLevel(persistence.HistoryTaskCategoryTimer).ScheduledTime,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we move this to Start()?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can do it in a separate PR.

taskAllocator: taskAllocator,
activeTaskExecutor: activeTaskExecutor,
activeQueueProcessor: activeQueueProcessor,
Expand Down Expand Up @@ -275,10 +275,10 @@ func (t *timerQueueProcessor) FailoverDomain(domainIDs map[string]struct{}) {
return
}

minLevel := t.shard.GetTimerClusterAckLevel(t.currentClusterName)
minLevel := t.shard.GetQueueClusterAckLevel(persistence.HistoryTaskCategoryTimer, t.currentClusterName).ScheduledTime
standbyClusterName := t.currentClusterName
for clusterName := range t.shard.GetClusterMetadata().GetEnabledClusterInfo() {
ackLevel := t.shard.GetTimerClusterAckLevel(clusterName)
ackLevel := t.shard.GetQueueClusterAckLevel(persistence.HistoryTaskCategoryTimer, clusterName).ScheduledTime
if ackLevel.Before(minLevel) {
minLevel = ackLevel
standbyClusterName = clusterName
Expand Down Expand Up @@ -493,8 +493,8 @@ func (t *timerQueueProcessor) completeTimer(ctx context.Context) error {
}
}

for _, failoverInfo := range t.shard.GetAllTimerFailoverLevels() {
failoverLevel := newTimerTaskKey(failoverInfo.MinLevel, 0)
for _, failoverInfo := range t.shard.GetAllFailoverLevels(persistence.HistoryTaskCategoryTimer) {
failoverLevel := newTimerTaskKey(failoverInfo.MinLevel.ScheduledTime, 0)
newAckLevel = minTaskKey(newAckLevel, failoverLevel)
}

Expand Down Expand Up @@ -539,7 +539,9 @@ func (t *timerQueueProcessor) completeTimer(ctx context.Context) error {

t.ackLevel = newAckLevelTimestamp

return t.shard.UpdateTimerAckLevel(t.ackLevel)
return t.shard.UpdateQueueAckLevel(persistence.HistoryTaskCategoryTimer, persistence.HistoryTaskKey{
ScheduledTime: t.ackLevel,
})
}

func loadTimerProcessingQueueStates(
Expand All @@ -548,7 +550,7 @@ func loadTimerProcessingQueueStates(
options *queueProcessorOptions,
logger log.Logger,
) []ProcessingQueueState {
ackLevel := shard.GetTimerClusterAckLevel(clusterName)
ackLevel := shard.GetQueueClusterAckLevel(persistence.HistoryTaskCategoryTimer, clusterName).ScheduledTime
if options.EnableLoadQueueStates() {
pStates := shard.GetTimerProcessingQueueStates(clusterName)
if validateProcessingQueueStates(pStates, ackLevel) {
Expand Down
4 changes: 3 additions & 1 deletion service/history/queue/timer_queue_standby_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ func newTimerQueueStandbyProcessor(
}

updateClusterAckLevel := func(ackLevel task.Key) error {
return shard.UpdateTimerClusterAckLevel(clusterName, ackLevel.(timerTaskKey).visibilityTimestamp)
return shard.UpdateQueueClusterAckLevel(persistence.HistoryTaskCategoryTimer, clusterName, persistence.HistoryTaskKey{
ScheduledTime: ackLevel.(timerTaskKey).visibilityTimestamp,
})
}

updateProcessingQueueStates := func(states []ProcessingQueueState) error {
Expand Down
Loading