sashapolo commented on code in PR #6309:
URL: https://github.com/apache/ignite-3/pull/6309#discussion_r2239880463
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java:
##########
@@ -882,55 +883,82 @@ private CompletableFuture<List<BinaryRow>>
retrieveExactEntriesUntilCursorEmpty(
FullyQualifiedResourceId cursorId,
int count
) {
- PartitionTimestampCursor cursor =
- remotelyTriggeredResourceRegistry.<CursorResource>register(
- cursorId,
- txCoordinatorId,
- () -> new CursorResource(
- mvDataStorage.scan(readTimestamp == null ?
HybridTimestamp.MAX_VALUE : readTimestamp)
- )
- ).cursor();
+ var result = new ArrayList<BinaryRow>(count);
- var resolutionFuts = new
ArrayList<CompletableFuture<TimedBinaryRow>>(count);
+ return retrieveExactEntriesUntilCursorEmpty(txId, txCoordinatorId,
readTimestamp, cursorId, count, result)
+ .thenApply(v -> {
+ closeCursorIfBatchNotFull(result, count, cursorId);
- while (resolutionFuts.size() < count && cursor.hasNext()) {
- ReadResult readResult = cursor.next();
- HybridTimestamp newestCommitTimestamp =
readResult.newestCommitTimestamp();
+ return result;
+ });
+ }
- TimedBinaryRow candidate;
- if (newestCommitTimestamp == null || !readResult.isWriteIntent()) {
- candidate = null;
- } else {
- BinaryRow committedRow =
cursor.committed(newestCommitTimestamp);
+ private CompletableFuture<Void> retrieveExactEntriesUntilCursorEmpty(
+ UUID txId,
+ UUID txCoordinatorId,
+ @Nullable HybridTimestamp readTimestamp,
+ FullyQualifiedResourceId cursorId,
+ int count,
+ List<BinaryRow> result
+ ) {
+ CursorResource resource = remotelyTriggeredResourceRegistry.register(
+ cursorId,
+ txCoordinatorId,
+ () -> new CursorResource(mvDataStorage.scan(readTimestamp ==
null ? HybridTimestamp.MAX_VALUE : readTimestamp))
+ );
- candidate = committedRow == null ? null : new
TimedBinaryRow(committedRow, newestCommitTimestamp);
- }
+ PartitionTimestampCursor cursor = resource.cursor();
- resolutionFuts.add(resolveReadResult(readResult, txId,
readTimestamp, () -> candidate));
Review Comment:
https://issues.apache.org/jira/browse/IGNITE-26055
--
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]