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

Remove unnecessary null check after CellUtil.cloneQualifier()

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 2.0.0-alpha-4, 2.0.0
    • None
    • None
    • Reviewed

    Description

      In master branch,

      hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
      // From line 2858
      public void prepareDeleteTimestamps(Mutation mutation, Map<byte[], List<Cell>> familyMap,
            byte[] byteNow) throws IOException {
          for (Map.Entry<byte[], List<Cell>> e : familyMap.entrySet()) {
            // ...
            for (int i=0; i < listSize; i++) {
              // ...
              if (cell.getTimestamp() == HConstants.LATEST_TIMESTAMP && CellUtil.isDeleteType(cell)) {
                byte[] qual = CellUtil.cloneQualifier(cell);
                if (qual == null) qual = HConstants.EMPTY_BYTE_ARRAY; // <-- here
                ...
      

      Might if (qual == null) qual = HConstants.EMPTY_BYTE_ARRAY; be removed?
      Could it be null after CellUtil.cloneQualifier()?

      hbase-common/src/main/java/org/apache/hadoop/hbase/CellUtil.java
      public static byte[] cloneQualifier(Cell cell){
        byte[] output = new byte[cell.getQualifierLength()];
        copyQualifierTo(cell, output, 0);
        return output;
      }
      

      Attachments

        Activity

          People

            xiangli Xiang Li
            xiangli Xiang Li
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: