rpuch commented on code in PR #1992:
URL: https://github.com/apache/ignite-3/pull/1992#discussion_r1182260512
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/SortedIndexLocker.java:
##########
@@ -155,15 +154,15 @@ public CompletableFuture<Lock> locksForInsert(UUID txId,
BinaryRow tableRow, Row
BinaryTuplePrefix prefix = BinaryTuplePrefix.fromBinaryTuple(key);
- // find next key
- Cursor<IndexRow> cursor = storage.scan(prefix, null,
SortedIndexStorage.GREATER);
+ // Find next key.
+ PeekCursor<IndexRow> cursor = storage.scan(prefix, null,
SortedIndexStorage.GREATER);
- BinaryTuple nextKey;
- if (cursor.hasNext()) {
- nextKey = cursor.next().indexColumns();
- } else { // otherwise INF
- nextKey = POSITIVE_INF;
- }
+ //noinspection ResultOfMethodCallIgnored
+ cursor.hasNext();
+
+ // "peek" works the same as "next" when "hasNext" is called. The only
difference is that it returns null instead of throwing
+ // an exception, if nothing is found.
+ BinaryTuple nextKey = indexKey(cursor.peek());
Review Comment:
My comment is not relevant anymore, please ignore it
--
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]