[ 
https://issues.apache.org/jira/browse/HBASE-16430?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Guangxu Cheng updated HBASE-16430:
----------------------------------
    Description: 
It will be good when move one table at the same time. 
However,will appear abnormal when move two or more tables at once.
For example,move tableA and tableB from Group foo to Group bar:

Now, you will be find tableB belongs to Group foo and Group bar.

Implementation of the moveTables as follows:
{code:title=RSGroupInfoManagerImpl.java|borderStyle=solid}
@Override
  public synchronized void moveTables(
      Set<TableName> tableNames, String groupName) throws IOException {
    if (groupName != null && !rsGroupMap.containsKey(groupName)) {
      throw new DoNotRetryIOException("Group "+groupName+" does not exist or is 
a special group");
    }

    Map<String,RSGroupInfo> newGroupMap = Maps.newHashMap(rsGroupMap);
    for(TableName tableName: tableNames) {
      if (tableMap.containsKey(tableName)) {
        RSGroupInfo src = new 
RSGroupInfo(rsGroupMap.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);
      }
    }
    flushConfig(newGroupMap);
  }
{code}

Should use newGroupMap instead of rsGroupMap:
{code}
RSGroupInfo src = new RSGroupInfo(rsGroupMap.get(tableMap.get(tableName)));
{code}
==>
{code}
RSGroupInfo src = new RSGroupInfo(newGroupMap.get(tableMap.get(tableName)));
{code}

  was:
it is an obvious bug when moves table. Implementation of the moveTables as 
follows:
{code:title=RSGroupInfoManagerImpl.java|borderStyle=solid}
@Override
  public synchronized void moveTables(
      Set<TableName> tableNames, String groupName) throws IOException {
    if (groupName != null && !rsGroupMap.containsKey(groupName)) {
      throw new DoNotRetryIOException("Group "+groupName+" does not exist or is 
a special group");
    }

    Map<String,RSGroupInfo> newGroupMap = Maps.newHashMap(rsGroupMap);
    for(TableName tableName: tableNames) {
      if (tableMap.containsKey(tableName)) {
        RSGroupInfo src = new 
RSGroupInfo(rsGroupMap.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);
      }
    }
    flushConfig(newGroupMap);
  }
{code}

Should use newGroupMap instead of rsGroupMap:
{code}
RSGroupInfo src = new RSGroupInfo(rsGroupMap.get(tableMap.get(tableName)));
{code}
==>
{code}
RSGroupInfo src = new RSGroupInfo(newGroupMap.get(tableMap.get(tableName)));
{code}


> RegionServer Group's bug when move tables
> -----------------------------------------
>
>                 Key: HBASE-16430
>                 URL: https://issues.apache.org/jira/browse/HBASE-16430
>             Project: HBase
>          Issue Type: Bug
>          Components: master
>    Affects Versions: 2.0.0
>            Reporter: Guangxu Cheng
>             Fix For: 2.0.0
>
>         Attachments: HBASE-16430-v1.patch
>
>
> It will be good when move one table at the same time. 
> However,will appear abnormal when move two or more tables at once.
> For example,move tableA and tableB from Group foo to Group bar:
> Now, you will be find tableB belongs to Group foo and Group bar.
> Implementation of the moveTables as follows:
> {code:title=RSGroupInfoManagerImpl.java|borderStyle=solid}
> @Override
>   public synchronized void moveTables(
>       Set<TableName> tableNames, String groupName) throws IOException {
>     if (groupName != null && !rsGroupMap.containsKey(groupName)) {
>       throw new DoNotRetryIOException("Group "+groupName+" does not exist or 
> is a special group");
>     }
>     Map<String,RSGroupInfo> newGroupMap = Maps.newHashMap(rsGroupMap);
>     for(TableName tableName: tableNames) {
>       if (tableMap.containsKey(tableName)) {
>         RSGroupInfo src = new 
> RSGroupInfo(rsGroupMap.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);
>       }
>     }
>     flushConfig(newGroupMap);
>   }
> {code}
> Should use newGroupMap instead of rsGroupMap:
> {code}
> RSGroupInfo src = new RSGroupInfo(rsGroupMap.get(tableMap.get(tableName)));
> {code}
> ==>
> {code}
> RSGroupInfo src = new RSGroupInfo(newGroupMap.get(tableMap.get(tableName)));
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to