Skip to content

Commit

Permalink
cluster: fix tso fallback when pd leader switch
Browse files Browse the repository at this point in the history
Signed-off-by: lhy1024 <[email protected]>
  • Loading branch information
lhy1024 committed Nov 7, 2024
1 parent b27f021 commit efbbdf7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion server/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,11 @@ func (c *RaftCluster) runServiceCheckJob() {
case <-schedulingTicker.C:
c.checkSchedulingService()
case <-tsoTicker.C:
c.checkTSOService()
c.RLock()
if c.IsRunning() {
c.checkTSOService()
}
c.RUnlock()
}
}
}
Expand Down Expand Up @@ -488,6 +492,7 @@ func (c *RaftCluster) stopTSOJobsIfNeeded() error {
return err
}
if allocator.IsInitialize() {
log.Info("closing the global TSO allocator")
c.tsoAllocator.ResetAllocatorGroup(tso.GlobalDCLocation, true)
failpoint.Inject("updateAfterResetTSO", func() {
allocator, _ := c.tsoAllocator.GetAllocator(tso.GlobalDCLocation)
Expand Down

0 comments on commit efbbdf7

Please sign in to comment.