You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Xiang Li (JIRA)" <ji...@apache.org> on 2019/03/23 02:46:00 UTC

[jira] [Commented] (HBASE-22089) HMaster#getClusterSchema() could return null and cause NPE

    [ https://issues.apache.org/jira/browse/HBASE-22089?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16799506#comment-16799506 ] 

Xiang Li commented on HBASE-22089:
----------------------------------

[~pingsutw] Maybe we could have a discussion in this proposal. 

> 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
>            Assignee: kevin su
>            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. Actually, it won't be ready until HMaster#initClusterSchemaService() is finished. 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.clusterSchemaService is not null.



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