diff --git a/pkg/tso/keyspace_group_manager.go b/pkg/tso/keyspace_group_manager.go index a82376430fa..8e2343a452b 100644 --- a/pkg/tso/keyspace_group_manager.go +++ b/pkg/tso/keyspace_group_manager.go @@ -109,7 +109,12 @@ func (s *state) getKeyspaceGroupMeta( ) (*AllocatorManager, *endpoint.KeyspaceGroup) { s.RLock() defer s.RUnlock() - return s.ams[groupID], s.kgs[groupID] + am := s.ams[groupID] + if s.kgs[groupID] == nil { + return am, nil + } + kg := *s.kgs[groupID] // copy the keyspace group meta to avoid datarace + return am, &kg } // getKeyspaceGroupMetaWithCheck returns the keyspace group meta of the given keyspace.