From commits-return-83581-archive-asf-public=cust-asf.ponee.io@hbase.apache.org Fri Mar 1 06:10:12 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 4AB52180647 for ; Fri, 1 Mar 2019 07:10:12 +0100 (CET) Received: (qmail 59403 invoked by uid 500); 1 Mar 2019 06:10:11 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 59394 invoked by uid 99); 1 Mar 2019 06:10:11 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Mar 2019 06:10:11 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 8E15982E8A; Fri, 1 Mar 2019 06:10:10 +0000 (UTC) Date: Fri, 01 Mar 2019 06:10:10 +0000 To: "commits@hbase.apache.org" Subject: [hbase] branch master updated: HBASE-21969 Improve the update of destination rsgroup of RSGroupInfoManagerImpl#moveTables() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <155142061047.32482.1069776302178455153@gitbox.apache.org> From: xucang@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: hbase X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: c19bc5911b31552eb5f84628e78675cf1907959d X-Git-Newrev: d725d33c4c4c42bce8f5c7ff36d3309cafe760f0 X-Git-Rev: d725d33c4c4c42bce8f5c7ff36d3309cafe760f0 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. xucang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/hbase.git The following commit(s) were added to refs/heads/master by this push: new d725d33 HBASE-21969 Improve the update of destination rsgroup of RSGroupInfoManagerImpl#moveTables() d725d33 is described below commit d725d33c4c4c42bce8f5c7ff36d3309cafe760f0 Author: Xiang Li AuthorDate: Wed Feb 27 16:20:44 2019 +0000 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..c89bba8 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 tableNames, String groupName) throws IOException { + // Check if rsGroupMap 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 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); }