From 1359ff690ba5f18aaff508a3ff0d4afbcbc8f596 Mon Sep 17 00:00:00 2001 From: Bin Shi <39923490+binshi-bing@users.noreply.github.com> Date: Wed, 24 May 2023 21:25:38 -0700 Subject: [PATCH] tso: log tso service discovery info on the client side only when the primary is changed (#6511) close tikv/pd#6508 Skip logging of the tso service discovery info when the secondar list is changed, because tso servers currently don't have consistent view of the member list due to remote etcd being used by tso service, which results in changing member list when the client queries the tso servers in round-robin. We need to improve the server side so that all tso servers can return the global consistent view of the keyspace groups' serving or membership info. Signed-off-by: Bin Shi Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com> --- client/tso_service_discovery.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/client/tso_service_discovery.go b/client/tso_service_discovery.go index 13d6ab24993..e3c67a92fa6 100644 --- a/client/tso_service_discovery.go +++ b/client/tso_service_discovery.go @@ -488,17 +488,15 @@ func (c *tsoServiceDiscovery) updateMember() error { } } - oldPrimary, primarySwitched, secondaryChanged := + oldPrimary, primarySwitched, _ := c.keyspaceGroupSD.update(keyspaceGroup, primaryAddr, secondaryAddrs, addrs) if primarySwitched { + log.Info("[tso] updated keyspace group service discovery info", + zap.String("keyspace-group-service", keyspaceGroup.String())) if err := c.afterPrimarySwitched(oldPrimary, primaryAddr); err != nil { return err } } - if primarySwitched || secondaryChanged { - log.Info("[tso] updated keyspace group service discovery info", - zap.String("keyspace-group-service", keyspaceGroup.String())) - } // Even if the primary address is empty, we still updated other returned info above, including the // keyspace group info and the secondary addresses.