Skip to content

Commit

Permalink
Properly handle min task ID > max task ID case during shard re-balanc…
Browse files Browse the repository at this point in the history
…ing (#3470)

* Properly handle min task ID > max task ID case by return unavailable error during shard re-balancing
  • Loading branch information
wxing1292 authored Oct 11, 2022
1 parent 158737a commit d33559a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion service/history/replication/ack_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,9 @@ func (p *ackMgrImpl) getTasks(
batchSize int,
) ([]*replicationspb.ReplicationTask, int64, error) {

if minTaskID == maxTaskID {
if minTaskID > maxTaskID {
return nil, 0, serviceerror.NewUnavailable("min task ID < max task ID, probably due to shard re-balancing")
} else if minTaskID == maxTaskID {
return []*replicationspb.ReplicationTask{}, maxTaskID, nil
}

Expand Down

0 comments on commit d33559a

Please # to comment.