Skip to content

Commit

Permalink
Removes key comparison optimization in SeekCursor
Browse files Browse the repository at this point in the history
...which didn't quite work in concurrent scenario with id-reuse.
  • Loading branch information
tinwelint committed Dec 16, 2016
1 parent 47a1195 commit c5b6095
Showing 1 changed file with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class SeekCursor<KEY,VALUE> implements RawCursor<Hit<KEY,VALUE>,IOException>
// data structures for the current b-tree node
private int pos;
private int keyCount;
private boolean currentContainsEnd;
private boolean reread;
private boolean resetPosition;
private long stableGeneration;
Expand Down Expand Up @@ -142,9 +141,6 @@ else if ( TreeNode.isNode( newGen ) )
// We've no come to the first relevant leaf, initialize the state for the coming leaf scan
this.pos = pos - 1;
this.keyCount = keyCount;
this.currentContainsEnd = layout.compare(
bTreeNode.keyAt( cursor, mutableKey, keyCount - 1 ), toExclusive ) >= 0;

}

@Override
Expand All @@ -167,8 +163,6 @@ public boolean next() throws IOException
if ( reread )
{
keyCount = bTreeNode.keyCount( cursor );
currentContainsEnd = layout.compare(
bTreeNode.keyAt( cursor, mutableKey, keyCount - 1 ), toExclusive ) >= 0;

// Keys could have been moved to the left so we need to make sure we are not missing any keys by
// moving position back until we find previously returned key
Expand Down Expand Up @@ -234,7 +228,7 @@ else if ( TreeNode.isNode( rightSibling ) )
}
else
{
if ( !currentContainsEnd || layout.compare( mutableKey, toExclusive ) < 0 )
if ( layout.compare( mutableKey, toExclusive ) < 0 )
{
if ( layout.compare( mutableKey, fromInclusive ) < 0 ||
( !first && layout.compare( prevKey, mutableKey ) >= 0 ) )
Expand Down

0 comments on commit c5b6095

Please sign in to comment.