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 <admin@liudos.us>
  • Loading branch information
lhy1024 authored and ti-chi-bot committed Nov 7, 2024
1 parent 649393a commit aed6ace
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion server/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,13 @@ func (c *RaftCluster) runServiceCheckJob() {
case <-schedulingTicker.C:
c.checkSchedulingService()
case <-tsoTicker.C:
c.checkTSOService()
// ensure raft cluster is running
// avoid unexpected startTSOJobsIfNeeded when raft cluster is stopping
c.RLock()
if c.running {
c.checkTSOService()
}
c.RUnlock()
}
}
}
Expand Down Expand Up @@ -489,6 +495,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 aed6ace

Please sign in to comment.