vldpyatkov commented on code in PR #2475:
URL: https://github.com/apache/ignite-3/pull/2475#discussion_r1302741325


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java:
##########
@@ -970,28 +976,41 @@ private CompletableFuture<Void> continueIndexScan(
                         return completedFuture(null); // End of range reached. 
Exit loop.
                     }
 
-                    return lockManager.acquire(txId, new LockKey(tableId(), 
currentRow.rowId()), LockMode.S)
+                    RowId rowId = currentRow.rowId();
+
+                    return lockManager.acquire(txId, new LockKey(tableId(), 
rowId), LockMode.S)
                             .thenComposeAsync(rowLock -> { // Table row S lock
-                                ReadResult readResult = 
mvDataStorage.read(currentRow.rowId(), HybridTimestamp.MAX_VALUE);
-                                return 
resolveAndCheckReadCompatibility(readResult, txId)
-                                        .thenCompose(resolvedReadResult -> {
-                                            if (resolvedReadResult != null) {
-                                                if 
(indexRowMatches(currentRow, resolvedReadResult, schemaAwareIndexStorage)) {
-                                                    
result.add(resolvedReadResult);
-                                                }
-                                            }
-
-                                            // Proceed scan.
-                                            return continueIndexScan(
-                                                    txId,
-                                                    schemaAwareIndexStorage,
-                                                    indexLocker,
-                                                    indexCursor,
-                                                    batchSize,
-                                                    result,
-                                                    isUpperBoundAchieved
-                                            );
-                                        });
+                                ReadResult readResult = 
mvDataStorage.read(rowId, HybridTimestamp.MAX_VALUE);
+                                return 
resolveAndCheckReadCompatibility(readResult, txId, () -> {
+                                    if (readResult.newestCommitTimestamp() == 
null) {

Review Comment:
   Because here we can be sure that is a write-intent. It happens after the 
resolution is finalized and the decision about getting committed value is 
applied.



##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java:
##########
@@ -1025,15 +1044,26 @@ private CompletableFuture<Void> continueIndexLookup(
         return lockManager.acquire(txId, new LockKey(tableId(), rowId), 
LockMode.S)
                 .thenComposeAsync(rowLock -> { // Table row S lock
                     ReadResult readResult = mvDataStorage.read(rowId, 
HybridTimestamp.MAX_VALUE);
-                    return resolveAndCheckReadCompatibility(readResult, txId)
-                            .thenCompose(resolvedReadResult -> {
-                                if (resolvedReadResult != null) {
-                                    result.add(resolvedReadResult);
-                                }
+                    return resolveAndCheckReadCompatibility(readResult, txId, 
() -> {
+                        if (readResult.newestCommitTimestamp() == null) {

Review Comment:
   We have a different resolution procedure for cursors and for storage values. 
If we hide this for storage, we will check it for cursors twice.



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to