hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuc...@apache.org
Subject [hbase] branch branch-2 updated: HBASE-21969 Improve the update of destination rsgroup of RSGroupInfoManagerImpl#moveTables()
Date Fri, 01 Mar 2019 06:14:14 GMT
This is an automated email from the ASF dual-hosted git repository.

xucang pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2 by this push:
     new e0be195  HBASE-21969 Improve the update of destination rsgroup of RSGroupInfoManagerImpl#moveTables()
e0be195 is described below

commit e0be1958b7ae4e0f10d50e17c7071f8f3c62b187
Author: Xiang LI <lixiang@freewheel.tv>
AuthorDate: Thu Feb 28 18:30:34 2019 +0800

    HBASE-21969 Improve the update of destination rsgroup of RSGroupInfoManagerImpl#moveTables()
---
 .../hadoop/hbase/rsgroup/RSGroupInfoManagerImpl.java | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManagerImpl.java
b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManagerImpl.java
index 956b448..3cb1960 100644
--- a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManagerImpl.java
+++ b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManagerImpl.java
@@ -255,23 +255,33 @@ final class RSGroupInfoManagerImpl implements RSGroupInfoManager {
   @Override
   public synchronized void moveTables(Set<TableName> tableNames, String groupName)
       throws IOException {
+    // Check if rsGroup contains the destination rsgroup
     if (groupName != null && !rsGroupMap.containsKey(groupName)) {
       throw new DoNotRetryIOException("Group " + groupName + " does not exist");
     }
 
+    // Make a copy of rsGroupMap to update
     Map<String, RSGroupInfo> newGroupMap = Maps.newHashMap(rsGroupMap);
+
+    // Remove tables from their original rsgroups
+    // and update the copy of rsGroupMap
     for (TableName tableName : tableNames) {
       if (tableMap.containsKey(tableName)) {
         RSGroupInfo src = new RSGroupInfo(newGroupMap.get(tableMap.get(tableName)));
         src.removeTable(tableName);
         newGroupMap.put(src.getName(), src);
       }
-      if (groupName != null) {
-        RSGroupInfo dst = new RSGroupInfo(newGroupMap.get(groupName));
-        dst.addTable(tableName);
-        newGroupMap.put(dst.getName(), dst);
-      }
     }
+
+    // Add tables to the destination rsgroup
+    // and update the copy of rsGroupMap
+    if (groupName != null) {
+      RSGroupInfo dstGroup = new RSGroupInfo(newGroupMap.get(groupName));
+      dstGroup.addAllTables(tableNames);
+      newGroupMap.put(dstGroup.getName(), dstGroup);
+    }
+
+    // Flush according to the updated copy of rsGroupMap
     flushConfig(newGroupMap);
   }
 


Mime
View raw message