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

Allow option in BBKVComparator.compare to do comparison without sequence id

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0.1
    • 3.0.0-alpha-1, 2.1.0, 2.0.2
    • None
    • None

    Description

      CellComparatorImpl#compare(final Cell a, final Cell b, boolean ignoreSequenceid) needs to ignore sequence id in comparison if ignoreSequenceId parameter is set to true but BBKVComparator.compare used internally for the cell of type ByteBufferKeyValue doesn't consider this.

       

      @Override
        public int compare(final Cell a, final Cell b, boolean ignoreSequenceid) {
      
          int diff = 0;
          // "Peel off" the most common path.
          if (a instanceof ByteBufferKeyValue && b instanceof ByteBufferKeyValue) {
            diff = BBKVComparator.compare((ByteBufferKeyValue)a, (ByteBufferKeyValue)b);
            if (diff != 0) {
              return diff;
            }
          } else {
            diff = compareRows(a, b);
            if (diff != 0) {
              return diff;
            }
      
            diff = compareWithoutRow(a, b);
            if (diff != 0) {
              return diff;
            }
          }
      
          // Negate following comparisons so later edits show up first mvccVersion: later sorts first
          return ignoreSequenceid? diff: Long.compare(b.getSequenceId(), a.getSequenceId());
        }
      

      Attachments

        1. HBASE-20795.patch
          3 kB
          Ankit Singhal

        Issue Links

          Activity

            People

              ankit@apache.org Ankit Singhal
              ankit@apache.org Ankit Singhal
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: