ibessonov commented on code in PR #6309: URL: https://github.com/apache/ignite-3/pull/6309#discussion_r2235370370
########## modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItTableScanTest.java: ########## @@ -0,0 +1,99 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.distributed; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.is; + +import java.util.List; +import java.util.function.Consumer; +import java.util.stream.IntStream; +import org.apache.ignite.internal.ClusterPerClassIntegrationTest; +import org.apache.ignite.tx.Transaction; +import org.junit.jupiter.api.Test; + +class ItTableScanTest extends ClusterPerClassIntegrationTest { + private static final String ZONE_NAME = "TEST_ZONE"; + + private static final String TABLE_NAME = "TEST"; + + @Override + protected int initialNodes() { + return 1; + } + + @Test + void testScanOrderIsPreservedWithWriteIntents() { Review Comment: Very nice test, thank you! ########## modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java: ########## @@ -974,6 +997,42 @@ private CompletableFuture<List<BinaryRow>> retrieveExactEntriesUntilCursorEmpty( }); } + private static void mergeRowsWithResolvedWriteIntents( + List<BinaryRow> rows, + Int2ObjectMap<CompletableFuture<TimedBinaryRow>> resolutionFutures, + List<BinaryRow> result + ) { + int curIndex = 0; + int rowsIndex = 0; + + for (Entry<CompletableFuture<TimedBinaryRow>> entry : resolutionFutures.int2ObjectEntrySet()) { Review Comment: What if we pre-inserted `null` into an original list, and then instead of joining sub-lists we would just do a `set` in a loop? Such an algorithm seems much more simple to me. Why have you decided to make it this complicated? Another option, even more efficient one. Have a `List<Object>`. When we're done, replace each completable future value with its result, and cast this list to `List<BinaryRow>`. A little bit dirty, but with a good comment it might be the best solution -- 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