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

Improve RSGroupInfo constructors

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.0-beta-1, 2.0.0
    • Component/s: None
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      hbase-common/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfo.java
      RSGroupInfo(String name, SortedSet<Address> servers, SortedSet<TableName> tables) {
          this.name = name;
          this.servers = servers == null? new TreeSet<>(): servers;
          this.servers.addAll(servers);
          this.tables = new TreeSet<>(tables);
      }
      

      2 improvements could be made:

      • When servers is not null, addAll(servers) tries to add all items in servers again. Seems not needed
      • new TreeSet<>(tables) has no null check on tables. The constructor of TreeSet does not do the null check either. It leads to NullPointerException if tables is null

        Attachments

        1. HBASE-19702.master.000.patch
          1 kB
          Xiang Li
        2. HBASE-19702.master.001.patch
          1 kB
          Xiang Li

          Activity

            People

            • Assignee:
              xiangli Xiang Li
              Reporter:
              xiangli Xiang Li
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: