Skip to content

Commit

Permalink
autoid_service: fix potential 'duplicated entry' error when tidb exit…
Browse files Browse the repository at this point in the history
… for AUTO_ID_CACHE=1 tables
  • Loading branch information
tiancaiamao committed Aug 28, 2023
1 parent 2163271 commit 2a4aefd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion autoid_service/autoid.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ func MockForTest(store kv.Storage) autoid.AutoIDAllocClient {

// Close closes the Service and clean up resource.
func (s *Service) Close() {
if s.leaderShip != nil {
if s.leaderShip != nil && s.leaderShip.IsOwner() {

Check warning on line 328 in autoid_service/autoid.go

View check run for this annotation

Codecov / codecov/patch

autoid_service/autoid.go#L328

Added line #L328 was not covered by tests
for k, v := range s.autoIDMap {
if v.base > 0 {
err := v.forceRebase(context.Background(), s.store, k.dbID, k.tblID, v.base, v.isUnsigned)
Expand Down

0 comments on commit 2a4aefd

Please sign in to comment.