Skip to content

Commit 9dbbad2

Browse files
authored
Fix standby timer task timestamp for history queue v2 (#7058)
1 parent 544894d commit 9dbbad2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

service/history/shard/context.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1301,7 +1301,9 @@ func (s *contextImpl) allocateTimerIDsLocked(
13011301
cluster := s.GetClusterMetadata().GetCurrentClusterName()
13021302
for _, task := range timerTasks {
13031303
ts := task.GetVisibilityTimestamp().Truncate(persistence.DBTimestampMinPrecision)
1304-
if task.GetVersion() != constants.EmptyVersion {
1304+
// always use current cluster's max read level for queue v2, and this is safe for rollback,
1305+
// because if we go back to queue v1, the standby queue and active queue will start from the same ack level to read tasks
1306+
if task.GetVersion() != constants.EmptyVersion && !s.GetConfig().EnableTimerQueueV2(s.shardID) {
13051307
// cannot use version to determine the corresponding cluster for timer task
13061308
// this is because during failover, timer task should be created as active
13071309
// or otherwise, failover + active processing logic may not pick up the task.
@@ -1559,6 +1561,7 @@ func acquireShard(
15591561

15601562
// initialize the cluster current time to be the same as ack level
15611563
remoteClusterCurrentTime := make(map[string]time.Time)
1564+
// TODO: get this information from QueueState once TimerAckLevel field is deprecated
15621565
scheduledTaskMaxReadLevelMap := make(map[string]time.Time)
15631566
for clusterName := range shardItem.GetClusterMetadata().GetEnabledClusterInfo() {
15641567
if clusterName != shardItem.GetClusterMetadata().GetCurrentClusterName() {

0 commit comments

Comments
 (0)