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

Xiang Li updated HBASE-22089:
-----------------------------
    Description: 
HMaster#getClusterSchema() has a lot of usage, for example:
{code:title=hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminEndpoint.java|borderStyle=solid}
void assignTableToGroup(TableDescriptor desc) throws IOException {
  String groupName =
      
master.getClusterSchema().getNamespace(desc.getTableName().getNamespaceAsString())
                .getConfigurationValue(RSGroupInfo.NAMESPACE_DESC_PROP_GROUP);
  ...
}
{code}
getClusterSchema() might return null when cluster schema service is not ready 
yet (it is one of the steps to start HMaster). See [this 
comment|https://issues.apache.org/jira/browse/HBASE-20690?focusedCommentId=16784549&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16784549]
 for details.
We need to add protections, like adding null check before calling 
getClusterSchema().getXXX(), or in HMaster#getClusterSchema(), add a loop to 
wait until this.

  was:
HMaster#getClusterSchema() has a lot of usage, for example:
{code:title=hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminEndpoint.java|borderStyle=solid}
void assignTableToGroup(TableDescriptor desc) throws IOException {
  String groupName =
      
master.getClusterSchema().getNamespace(desc.getTableName().getNamespaceAsString())
                .getConfigurationValue(RSGroupInfo.NAMESPACE_DESC_PROP_GROUP);
  ...
}
{code}
getClusterSchema() might return null when cluster schema service is not ready 
yet (it is one of the steps to start HMaster). See [this 
comment|https://issues.apache.org/jira/browse/HBASE-20690?focusedCommentId=16784549&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16784549]
 for details.
We need to add a protection here (like adding null check before calling 
getClusterSchema().getXXX()).


> HMaster#getClusterSchema() could return null and cause NPE
> ----------------------------------------------------------
>
>                 Key: HBASE-22089
>                 URL: https://issues.apache.org/jira/browse/HBASE-22089
>             Project: HBase
>          Issue Type: Improvement
>          Components: master
>            Reporter: Xiang Li
>            Priority: Minor
>
> HMaster#getClusterSchema() has a lot of usage, for example:
> {code:title=hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminEndpoint.java|borderStyle=solid}
> void assignTableToGroup(TableDescriptor desc) throws IOException {
>   String groupName =
>       
> master.getClusterSchema().getNamespace(desc.getTableName().getNamespaceAsString())
>                 .getConfigurationValue(RSGroupInfo.NAMESPACE_DESC_PROP_GROUP);
>   ...
> }
> {code}
> getClusterSchema() might return null when cluster schema service is not ready 
> yet (it is one of the steps to start HMaster). See [this 
> comment|https://issues.apache.org/jira/browse/HBASE-20690?focusedCommentId=16784549&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16784549]
>  for details.
> We need to add protections, like adding null check before calling 
> getClusterSchema().getXXX(), or in HMaster#getClusterSchema(), add a loop to 
> wait until this.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to