Reidddddd commented on a change in pull request #1435: HBASE-24112 [RSGroup]
Support renaming rsgroup
URL: https://github.com/apache/hbase/pull/1435#discussion_r403810931
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManagerImpl.java
##########
@@ -1221,4 +1221,33 @@ public String determineRSGroupInfoForTable(TableName
tableName) {
return script.getRSGroup(tableName.getNamespaceAsString(),
tableName.getQualifierAsString());
}
+ @Override
+ public synchronized void renameRSGroup(String oldName, String newName)
throws IOException {
+ if (oldName.equals(RSGroupInfo.DEFAULT_GROUP)) {
+ throw new ConstraintException(RSGroupInfo.DEFAULT_GROUP + " can't be
rename");
+ }
+ checkGroupName(newName);
+
+ RSGroupInfo oldRSG = getRSGroupInfo(oldName);
+ Map<String, RSGroupInfo> rsGroupMap = holder.groupName2Group;
+ Map<String, RSGroupInfo> newGroupMap = Maps.newHashMap(rsGroupMap);
+ newGroupMap.remove(oldRSG.getName());
+ RSGroupInfo newRSG = new RSGroupInfo(newName, oldRSG.getServers());
+ newGroupMap.put(newRSG.getName(), newRSG);
Review comment:
fixed
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services