HBASE-24675: On Master restart all servers are assigned to default rsgroup

Closes #2053

Signed-off-by: Viraj Jasani <vjasani@apache.org>
This commit is contained in:
Mohammad Arshad 2020-07-17 22:33:52 +05:30 committed by Viraj Jasani
parent 6ae2fdd6b2
commit 1781185b7b
No known key found for this signature in database
GPG Key ID: B3D6C0B41C8ADFD5
1 changed files with 7 additions and 2 deletions

View File

@ -591,7 +591,7 @@ final class RSGroupInfoManagerImpl implements RSGroupInfoManager {
// This is added to the last of the list so it overwrites the 'default' rsgroup loaded
// from region group table or zk
groupList.add(new RSGroupInfo(RSGroupInfo.DEFAULT_GROUP, getDefaultServers()));
groupList.add(new RSGroupInfo(RSGroupInfo.DEFAULT_GROUP, getDefaultServers(groupList)));
// populate the data
HashMap<String, RSGroupInfo> newGroupMap = Maps.newHashMap();
@ -726,9 +726,14 @@ final class RSGroupInfoManagerImpl implements RSGroupInfoManager {
// Called by ServerEventsListenerThread. Presume it has lock on this manager when it runs.
private SortedSet<Address> getDefaultServers() {
return getDefaultServers(listRSGroups()/* get from rsGroupMap */);
}
// Called by ServerEventsListenerThread. Presume it has lock on this manager when it runs.
private SortedSet<Address> getDefaultServers(List<RSGroupInfo> rsGroupInfoList) {
// Build a list of servers in other groups than default group, from rsGroupMap
Set<Address> serversInOtherGroup = new HashSet<>();
for (RSGroupInfo group : listRSGroups() /* get from rsGroupMap */) {
for (RSGroupInfo group : rsGroupInfoList) {
if (!RSGroupInfo.DEFAULT_GROUP.equals(group.getName())) { // not default group
serversInOtherGroup.addAll(group.getServers());
}