From eb8bf6438926a3bc580bfeb2c078e4b0475af199 Mon Sep 17 00:00:00 2001 From: JmPotato Date: Tue, 4 Apr 2023 18:57:08 +0800 Subject: [PATCH] Fix the race Signed-off-by: JmPotato --- server/server.go | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/server/server.go b/server/server.go index 2958740867d..b2573032d7f 100644 --- a/server/server.go +++ b/server/server.go @@ -406,8 +406,6 @@ func (s *Server) startServer(ctx context.Context) error { s.pdProtoFactory = &tsoutil.PDProtoFactory{} if !s.IsAPIServiceMode() { s.tsoAllocatorManager = tso.NewAllocatorManager(s.ctx, mcs.DefaultKeySpaceGroupID, s.member, s.rootPath, s.storage, s, false) - // Set up the Global TSO Allocator here, it will be initialized once the PD campaigns leader successfully. - s.tsoAllocatorManager.SetUpGlobalAllocator(ctx, s.member.GetLeadership(), false) // When disabled the Local TSO, we should clean up the Local TSO Allocator's meta info written in etcd if it exists. if !s.cfg.EnableLocalTSO { if err = s.tsoAllocatorManager.CleanUpDCLocation(); err != nil { @@ -561,9 +559,6 @@ func (s *Server) startServerLoop(ctx context.Context) { if s.IsAPIServiceMode() { // disable tso service in api server s.serverLoopWg.Add(1) go s.watchServicePrimaryAddrLoop(mcs.TSOServiceName) - } else { // enable tso service - s.serverLoopWg.Add(1) - go s.tsoAllocatorLoop() } } @@ -589,17 +584,6 @@ func (s *Server) serverMetricsLoop() { } } -// tsoAllocatorLoop is used to run the TSO Allocator updating daemon. -func (s *Server) tsoAllocatorLoop() { - defer logutil.LogPanic() - defer s.serverLoopWg.Done() - - ctx, cancel := context.WithCancel(s.serverLoopCtx) - defer cancel() - s.tsoAllocatorManager.AllocatorDaemon(ctx) - log.Info("server is closed, exit allocator loop") -} - // encryptionKeyManagerLoop is used to start monitor encryption key changes. func (s *Server) encryptionKeyManagerLoop() { defer logutil.LogPanic()