Skip to content

Commit

Permalink
fix Nil pointer deference when (*AllocatorManager).GetMember
Browse files Browse the repository at this point in the history
If the desired keyspace group fall back to the default keyspace group and the AM isn't initialized, return not served error.

Signed-off-by: Bin Shi <binshi.bing@gmail.com>
  • Loading branch information
binshi-bing committed Apr 25, 2023
1 parent 20c3154 commit a0eb272
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/tso/keyspace_group_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ func (s *state) getAMWithMembershipCheck(
// The keyspace doesn't belong to any keyspace group, so return the default keyspace group.
// It's for migrating the existing keyspaces which have no keyspace group assigned, so the
// the default keyspace group is used to serve the keyspaces.
if s.ams[mcsutils.DefaultKeyspaceGroupID] == nil {
return nil, mcsutils.DefaultKeyspaceGroupID, errs.ErrKeyspaceNotAssigned.FastGenByArgs(keyspaceID)
}
return s.ams[mcsutils.DefaultKeyspaceGroupID], mcsutils.DefaultKeyspaceGroupID, nil
}

Expand Down

0 comments on commit a0eb272

Please sign in to comment.