Yutong Xiao created HBASE-27246:
-----------------------------------

             Summary: RSGroupMappingScript#getRSGroup should be synchronised
                 Key: HBASE-27246
                 URL: https://issues.apache.org/jira/browse/HBASE-27246
             Project: HBase
          Issue Type: Bug
            Reporter: Yutong Xiao
            Assignee: Yutong Xiao
         Attachments: Test.java

We are using version 1.4.12 and met a problem in table creation phase some 
time. The error message is:

{code:java}
2022-07-26 19:26:20.122 [http-nio-8078-exec-24,d2ad4b13b542b6fb] ERROR 
HBaseServiceImpl - hbase create table: xxx:xxxx failed. 
(HBaseServiceImpl.java:116)
java.lang.RuntimeException: 
org.apache.hadoop.hbase.constraint.ConstraintException: 
org.apache.hadoop.hbase.constraint.ConstraintException: Default RSGroup (default
default) for this table's namespace does not exist.
{code}
The rsgroup here should be one 'default' but not two consecutive 'default'.  
The code to get RSGroup from a mapping script is:

{code:java}
String getRSGroup(String namespace, String tablename) {
      if (rsgroupMappingScript == null) {
        return null;
      }
      String[] exec = rsgroupMappingScript.getExecString();
      exec[1] = namespace;
      exec[2] = tablename;
      try {
        rsgroupMappingScript.execute();
      } catch (IOException e) {
        // This exception may happen, like process doesn't have permission to 
run this script.
        LOG.error("{}, placing {} back to default rsgroup", e.getMessage(),
          TableName.valueOf(namespace, tablename));
        return RSGroupInfo.DEFAULT_GROUP;
      }
      return rsgroupMappingScript.getOutput().trim();
    }
{code}
here the rsgourpMappingScript could be executed by multi-threads.

To test it is a multi-thread issue, I ran a piece of code locally and found 
that the hadoop ShellCommandExecutor is not thread-safe (I run the code with 
hadoop 2.10.0 and 3.3.2). So that we should make this method synchronized.




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to