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

    • Sub-task
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 2.0.0
    • None
    • None
    • 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_1.patch
          14 kB
          ramkrishna.s.vasudevan
        2. HBASE-13939_2.patch
          15 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_branch-1.1.patch
          14 kB
          ramkrishna.s.vasudevan
        6. HBASE-13939.patch
          13 kB
          ramkrishna.s.vasudevan

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: