sanpwc commented on code in PR #1230:
URL: https://github.com/apache/ignite-3/pull/1230#discussion_r1003555204


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java:
##########
@@ -337,33 +339,59 @@ private CompletableFuture<Object> 
processReadOnlyScanRetrieveBatchAction(ReadOnl
     private CompletableFuture<Object> 
processReadOnlySingleEntryAction(ReadOnlySingleRowReplicaRequest request) {
         ByteBuffer searchKey = request.binaryRow().keySlice();
 
-        UUID indexId = indexIdOrDefault(indexScanId/*request.indexToUse()*/);
-
         if (request.requestType() != RequestType.RO_GET) {
             throw new IgniteInternalException(Replicator.REPLICA_COMMON_ERR,
                     IgniteStringFormatter.format("Unknown single request 
[actionType={}]", request.requestType()));
         }
 
         //TODO: IGNITE-17868 Integrate indexes into rowIds resolution along 
with proper lock management on search rows.
-        RowId rowId = rowIdByKey(indexId, searchKey);
+        HybridTimestamp readTimestamp = request.readTimestamp();
+
+        try (PartitionTimestampCursor scan = 
mvDataStorage.scan(readTimestamp)) {
+            while (scan.hasNext()) {
+                ReadResult readResult = scan.next();
+                if (readResult.binaryRow() == null) {
+                    HybridTimestamp newestCommitTimestamp = 
readResult.newestCommitTimestamp();
+                    if (newestCommitTimestamp == null) {
+                        throw new AssertionError("Unexpected null value of the 
newest committed timestamp.");
+                    }
 
-        ReadResult readResult = rowId == null ? null : 
mvDataStorage.read(rowId, request.timestamp());
+                    BinaryRow candidate = 
scan.committed(readResult.newestCommitTimestamp());

Review Comment:
   No need to fix, that is reworked within 
https://github.com/apache/ignite-3/pull/1191/files
   `return resolveRowByPk(searchKey, request.timestamp(), (rowId, binaryRow) -> 
CompletableFuture.completedFuture(binaryRow));`



##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java:
##########
@@ -376,34 +404,61 @@ private CompletableFuture<Object> 
processReadOnlyMultiEntryAction(ReadOnlyMultiR
         Collection<ByteBuffer> keyRows = request.binaryRows().stream().map(br 
-> br.keySlice()).collect(
                 Collectors.toList());
 
-        UUID indexId = indexIdOrDefault(indexScanId/*request.indexToUse()*/);
-
-        if (request.requestType() != RequestType.RO_GET_ALL) {
+        if (request.requestType() !=  RequestType.RO_GET_ALL) {
             throw new IgniteInternalException(Replicator.REPLICA_COMMON_ERR,
                     IgniteStringFormatter.format("Unknown single request 
[actionType={}]", request.requestType()));
         }
 
         ArrayList<BinaryRow> result = new ArrayList<>(keyRows.size());
 
-        for (ByteBuffer searchKey : keyRows) {
-            //TODO: IGNITE-17868 Integrate indexes into rowIds resolution 
along with proper lock management on search rows.
-            RowId rowId = rowIdByKey(indexId, searchKey);
-
-            ReadResult readResult = rowId == null ? null : 
mvDataStorage.read(rowId, request.timestamp());
+        //TODO: IGNITE-17868 Integrate indexes into rowIds resolution along 
with proper lock management on search rows.
+        HybridTimestamp readTimestamp = request.readTimestamp();
 
-            result.add(readResult == null ? null : 
resolveReadResult(readResult, request.timestamp(), () -> {
-                if (readResult.newestCommitTimestamp() == null) {
-                    return null;
-                }
+        try (PartitionTimestampCursor scan = 
mvDataStorage.scan(readTimestamp)) {
+            while (scan.hasNext()) {
+                ReadResult readResult = scan.next();
 
-                ReadResult committedReadResult = mvDataStorage.read(rowId, 
readResult.newestCommitTimestamp());
+                for (ByteBuffer searchKey : keyRows) {
+                    if (readResult.binaryRow() == null) {
+                        HybridTimestamp newestCommitTimestamp = 
readResult.newestCommitTimestamp();
+                        if (newestCommitTimestamp == null) {
+                            throw new AssertionError("Unexpected null value of 
the newest committed timestamp.");
+                        }
 
-                assert !committedReadResult.isWriteIntent() :
-                        "The result is not committed [rowId=" + rowId + ", 
timestamp="
-                                + readResult.newestCommitTimestamp() + ']';
+                        BinaryRow candidate = 
scan.committed(readResult.newestCommitTimestamp());

Review Comment:
   No need to fix, that is reworked within 
https://github.com/apache/ignite-3/pull/1191/files
   `return resolveRowByPk(searchKey, request.timestamp(), (rowId, binaryRow) -> 
CompletableFuture.completedFuture(binaryRow));`



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

Reply via email to