maedhroz commented on code in PR #2943:
URL: https://github.com/apache/cassandra/pull/2943#discussion_r1409978328
##########
src/java/org/apache/cassandra/index/sai/disk/v1/keystore/KeyLookup.java:
##########
@@ -265,42 +258,39 @@ public void reset() throws IOException
readCurrentKey();
}
-
@Override
public void close()
{
keysInput.close();
}
- private void updateCurrentBlockIndex(long pointId)
+ private int keyInBlockComparison(long pointId, BytesRef key)
{
- currentBlockIndex = pointId >>> blockShift;
- }
+ updateCurrentBlockIndex(pointId);
+ resetToCurrentBlock();
+ if (compareKeys(key, currentKey) < 0)
+ return -1;
- private boolean notInCurrentBlock(long pointId, BytesRef key)
- {
- if (inLastBlock(pointId))
- return false;
+ if (currentBlockIndex == blockOffsets.length() -1)
+ return 0;
Review Comment:
So to check my understanding, so far we've returned -1 if we're less than
the first key in the current block (after updating to the block for the point
ID) and then if we're at the last block, we assume the key exists there and
return zero? (Haven't looked at the rest of the code yet to figure out if we
guarantee the key exists somewhere...)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]