Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-22089

HMaster#getClusterSchema() could return null and cause NPE

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • master
    • None

    Description

      HMaster#getClusterSchema() has a lot of usage, for example:

      hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminEndpoint.java
      void assignTableToGroup(TableDescriptor desc) throws IOException {
        String groupName =
            master.getClusterSchema().getNamespace(desc.getTableName().getNamespaceAsString())
                      .getConfigurationValue(RSGroupInfo.NAMESPACE_DESC_PROP_GROUP);
        ...
      }
      

      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 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.

      Attachments

        1. HBASE-22089.v0.patch
          1 kB
          Kevin Su

        Activity

          People

            pingsutw Kevin Su
            xiangli Xiang Li
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: