Copilot commented on code in PR #6309:
URL: https://github.com/apache/ignite-3/pull/6309#discussion_r2227563415


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java:
##########
@@ -891,27 +891,37 @@ private CompletableFuture<List<BinaryRow>> 
retrieveExactEntriesUntilCursorEmpty(
                         )
                 ).cursor();
 
-        var resolutionFuts = new 
ArrayList<CompletableFuture<TimedBinaryRow>>(count);
+        var rows = new ArrayList<BinaryRow>(count);
 
-        while (resolutionFuts.size() < count && cursor.hasNext()) {
+        var resolutionFuts = new 
ArrayList<CompletableFuture<TimedBinaryRow>>();
+
+        while ((rows.size() + resolutionFuts.size()) < count && 
cursor.hasNext()) {
             ReadResult readResult = cursor.next();
-            HybridTimestamp newestCommitTimestamp = 
readResult.newestCommitTimestamp();
 
-            TimedBinaryRow candidate;
-            if (newestCommitTimestamp == null || !readResult.isWriteIntent()) {
-                candidate = null;
+            BinaryRow row = readResult.binaryRow();
+            UUID retrievedResultTxId = readResult.transactionId();
+
+            if (!readResult.isWriteIntent() || (readTimestamp == null && 
txId.equals(retrievedResultTxId))) {
+                if (row != null) {
+                    rows.add(row);
+                }
             } else {
-                BinaryRow committedRow = 
cursor.committed(newestCommitTimestamp);
+                HybridTimestamp newestCommitTimestamp = 
readResult.newestCommitTimestamp();
 
-                candidate = committedRow == null ? null : new 
TimedBinaryRow(committedRow, newestCommitTimestamp);
-            }
+                TimedBinaryRow candidate;
+                if (newestCommitTimestamp == null) {
+                    candidate = null;
+                } else {
+                    BinaryRow committedRow = 
cursor.committed(newestCommitTimestamp);
 
-            resolutionFuts.add(resolveReadResult(readResult, txId, 
readTimestamp, () -> candidate));
-        }
+                    candidate = committedRow == null ? null : new 
TimedBinaryRow(committedRow, newestCommitTimestamp);
+                }
 
-        return allOf(resolutionFuts.toArray(new 
CompletableFuture[0])).thenCompose(unused -> {
-            var rows = new ArrayList<BinaryRow>(count);
+                resolutionFuts.add(resolveWriteIntentAsync(readResult, 
readTimestamp, () -> candidate));

Review Comment:
   The method resolveWriteIntentAsync is being called but this method is not 
defined or visible in the current diff. This appears to be a new method that 
should replace resolveReadResult, but without seeing its implementation, this 
could cause a compilation error.



##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java:
##########
@@ -3225,9 +3237,7 @@ private CompletableFuture<IgniteBiTuple<RowId, 
Collection<Lock>>> takeLocksForRe
             @Nullable HybridTimestamp timestamp,
             Supplier<@Nullable TimedBinaryRow> lastCommitted
     ) {

Review Comment:
   The null check for readResult was removed, but the method still accesses 
readResult.isWriteIntent() without verifying readResult is not null. This could 
cause a NullPointerException if readResult is null.
   ```suggestion
       ) {
           if (readResult == null) {
               return completedFuture(null);
           }
   ```



-- 
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