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:43:44 +05:30 committed by Viraj Jasani
parent 4001d3f2d2
commit e08da3bf26
No known key found for this signature in database
GPG Key ID: B3D6C0B41C8ADFD5
1 changed files with 9 additions and 2 deletions

View File

@ -546,7 +546,8 @@ 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(), orphanTables));
groupList.add(
new RSGroupInfo(RSGroupInfo.DEFAULT_GROUP, getDefaultServers(groupList), orphanTables));
// populate the data
HashMap<String, RSGroupInfo> newGroupMap = Maps.newHashMap();
@ -705,9 +706,15 @@ final class RSGroupInfoManagerImpl implements RSGroupInfoManager {
// Called by ServerEventsListenerThread. Presume it has lock on this manager when it runs.
private SortedSet<Address> getDefaultServers() throws IOException {
return getDefaultServers(listRSGroups());
}
// Called by ServerEventsListenerThread. Presume it has lock on this manager when it runs.
private SortedSet<Address> getDefaultServers(List<RSGroupInfo> rsGroupInfoList)
throws IOException {
// 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());
}