Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-13500 Deprecate KVComparator and move to CellComparator
  3. HBASE-13939

Make HFileReaderImpl.getFirstKeyInBlock() to return a Cell

    XMLWordPrintableJSON

    Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.0
    • Component/s: None
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      The getFirstKeyInBlock() in HFileReaderImpl is returning a BB. It is getting used in seekBefore cases. Because we return a BB we create a KeyOnlyKV once for comparison

            if (reader.getComparator()
                .compareKeyIgnoresMvcc(
                    new KeyValue.KeyOnlyKeyValue(firstKey.array(), firstKey.arrayOffset(),
                        firstKey.limit()), key) >= 0) {
              long previousBlockOffset = seekToBlock.getPrevBlockOffset();
              // The key we are interested in
              if (previousBlockOffset == -1) {
                // we have a 'problem', the key we want is the first of the file.
                return false;
              }
      ........
      

      And if the compare fails we again create another KeyOnlyKv

            Cell firstKeyInCurrentBlock = new KeyValue.KeyOnlyKeyValue(Bytes.getBytes(firstKey));
            loadBlockAndSeekToKey(seekToBlock, firstKeyInCurrentBlock, true, key, true);
      

      So one object will be enough and that can be returned by getFirstKeyInBlock. Also will be useful when we go with Buffered backed server cell to change in one place.

        Attachments

        1. HBASE-13939.patch
          13 kB
          ramkrishna.s.vasudevan
        2. HBASE-13939_branch-1.1.patch
          14 kB
          ramkrishna.s.vasudevan
        3. HBASE-13939_3.patch
          15 kB
          ramkrishna.s.vasudevan
        4. HBASE-13939_3.patch
          15 kB
          ramkrishna.s.vasudevan
        5. HBASE-13939_2.patch
          15 kB
          ramkrishna.s.vasudevan
        6. HBASE-13939_1.patch
          14 kB
          ramkrishna.s.vasudevan

          Issue Links

            Activity

              People

              • Assignee:
                ram_krish ramkrishna.s.vasudevan
                Reporter:
                ram_krish ramkrishna.s.vasudevan
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: