Skip to content

Commit

Permalink
Refine keyspace.Bootstrap
Browse files Browse the repository at this point in the history
Signed-off-by: Bin Shi <[email protected]>
  • Loading branch information
binshi-bing committed Apr 13, 2023
1 parent c785844 commit e88e809
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions pkg/keyspace/tso_keyspace_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ func NewKeyspaceGroupManager(ctx context.Context, store endpoint.KeyspaceGroupSt

// Bootstrap saves default keyspace group info and init group mapping in the memory.
func (m *GroupManager) Bootstrap() error {
// Force the membership restriction that the default keyspace must belong to default keyspace group.
// Have no information to specify the distribution of the default keyspace group replicas, so just
// leave the replica/member list empty. The TSO service will assign the default keyspace group replica
// to every tso node/pod by default.
defaultKeyspaceGroup := &endpoint.KeyspaceGroup{
ID: utils.DefaultKeyspaceGroupID,
UserKind: endpoint.Basic.String(),
Expand All @@ -72,9 +76,6 @@ func (m *GroupManager) Bootstrap() error {
return err
}

userKind := endpoint.StringUserKind(defaultKeyspaceGroup.UserKind)
m.groups[userKind].Put(defaultKeyspaceGroup)

// Load all the keyspace groups from the storage and add to the respective userKind groups.
groups, err := m.store.LoadKeyspaceGroups(utils.DefaultKeyspaceGroupID, 0)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion pkg/tso/keyspace_group_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,8 @@ func (kgm *KeyspaceGroupManager) checkInitProgress(ctx context.Context, cancel c
}

func (kgm *KeyspaceGroupManager) initDefaultKeysapceGroup(keyspaces []uint32) {
log.Info("initializing default keyspace group", zap.Any("keyspaces", keyspaces))
log.Info("initializing default keyspace group",
zap.Int("keyspaces-length", len(keyspaces)))

group := &endpoint.KeyspaceGroup{
ID: mcsutils.DefaultKeyspaceGroupID,
Expand Down

0 comments on commit e88e809

Please sign in to comment.