[
https://issues.apache.org/jira/browse/HBASE-20795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16524329#comment-16524329
]
Ankit Singhal commented on HBASE-20795:
---------------------------------------
bq. How'd you arrive at the need for this fix?
[~stack], Actually Phoenix has its own internal memstore for concurrent index
writes where we need to compare cells without sequence id and for that we
Delegate compare to CellComparatorImpl#compare(final Cell a, final Cell b,
boolean ignoreSequenceid).
I observed a regression in our tests after HBASE-20564.
bq. "This is a tricked-out Comparator at heart of hbase read and write. It is
in the HOT path so we try all sorts of ugly stuff so we can go faster. See
below in this javadoc comment for the list."
bq. I did a bunch of work trying to minimize the bytecode these methods
generate as they are the hottest code paths in our code base – small
differences here show at the macro scale. This fix adds code. At one stage I'd
duplicated the code here into CellComparatorImpl trying to make it so we
minimize the Cell types that traverse this code path. Perhaps we should do that
again? I'm still profiling. Let me add this in for now and if it causes
slowdown, I'll dupe the method.
Thanks [~stack] for checking.
> Allow option in BBKVComparator.compare to do comparison without sequence id
> ---------------------------------------------------------------------------
>
> Key: HBASE-20795
> URL: https://issues.apache.org/jira/browse/HBASE-20795
> Project: HBase
> Issue Type: Bug
> Affects Versions: 2.0.1
> Reporter: Ankit Singhal
> Assignee: Ankit Singhal
> Priority: Major
> Attachments: HBASE-20795.patch
>
>
> 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.
> {code}
> @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());
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)