From 5122707763a6202b7c031adb0ee38822100364f4 Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Thu, 13 Apr 2023 16:55:05 +0800 Subject: [PATCH] fix reset ts Signed-off-by: Ryan Leung --- pkg/tso/global_allocator.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/tso/global_allocator.go b/pkg/tso/global_allocator.go index d79a9b2f0b7..67e398bbcee 100644 --- a/pkg/tso/global_allocator.go +++ b/pkg/tso/global_allocator.go @@ -543,6 +543,11 @@ func (gta *GlobalTSOAllocator) campaignLeader() { }() gta.member.EnableLeader() + defer resetLeaderOnce.Do(func() { + cancel() + gta.member.ResetLeader() + }) + // TODO: if enable-local-tso is true, check the cluster dc-location after the primary is elected // go gta.tsoAllocatorManager.ClusterDCLocationChecker() log.Info("tso primary is ready to serve", zap.String("tso-primary-name", gta.member.Name()))