You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by as...@apache.org on 2025/06/20 07:09:10 UTC

(ignite-3) branch main updated: IGNITE-25598 Drop result ordering guarantee for batched updates

This is an automated email from the ASF dual-hosted git repository.

ascherbakov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/main by this push:
     new 7613cedc629 IGNITE-25598 Drop result ordering guarantee for batched updates
7613cedc629 is described below

commit 7613cedc62938c0a879d3fcfb950ed0000f3314f
Author: Alexey Scherbakov <al...@gmail.com>
AuthorDate: Fri Jun 20 10:09:01 2025 +0300

    IGNITE-25598 Drop result ordering guarantee for batched updates
---
 .../java/org/apache/ignite/table/RecordView.java   | 25 ++++++--------
 .../client-test/key_value_binary_view_test.cpp     | 11 ------
 .../cpp/tests/client-test/key_value_view_test.cpp  |  9 -----
 .../tests/client-test/record_binary_view_test.cpp  | 11 ------
 .../cpp/tests/client-test/record_view_test.cpp     |  9 -----
 .../ignite/internal/table/ItInternalTableTest.java | 40 ++++++++--------------
 .../sql/engine/exec/UpdatableTableImpl.java        |  4 +--
 .../ignite/internal/table/InternalTable.java       | 15 ++++----
 .../distributed/storage/InternalTableImpl.java     | 39 +++++++++++----------
 .../distributed/storage/InternalTableImplTest.java |  9 +++--
 10 files changed, 61 insertions(+), 111 deletions(-)

diff --git a/modules/api/src/main/java/org/apache/ignite/table/RecordView.java b/modules/api/src/main/java/org/apache/ignite/table/RecordView.java
index 96f3db83485..de62e1b76d7 100644
--- a/modules/api/src/main/java/org/apache/ignite/table/RecordView.java
+++ b/modules/api/src/main/java/org/apache/ignite/table/RecordView.java
@@ -188,8 +188,7 @@ public interface RecordView<R> extends DataStreamerTarget<R>, CriteriaQuerySourc
      *
      * @param tx Transaction or {@code null} for implicit transaction.
      * @param recs Records to insert into the table. The records cannot be {@code null}.
-     * @return Skipped records. The order of collection elements is guaranteed to be the same as the order of {@code recs}. If a record is
-     *         inserted, the element will be excluded from the collection result.
+     * @return Skipped records. If a record is inserted, the element will be excluded from the collection result.
      */
     List<R> insertAll(@Nullable Transaction tx, Collection<R> recs);
 
@@ -198,9 +197,8 @@ public interface RecordView<R> extends DataStreamerTarget<R>, CriteriaQuerySourc
      *
      * @param tx Transaction or {@code null} for implicit transaction.
      * @param recs Records to insert into the table. The records cannot be {@code null}.
-     * @return Future representing pending completion of the operation, with rejected rows for insertion in the result. The order of
-     *         collection elements is guaranteed to be the same as the order of {@code recs}. If a record is inserted, the element will be
-     *         excluded from the collection result.
+     * @return Future representing pending completion of the operation, with rejected rows for insertion in the result. If a record is
+     *         inserted, the element will be excluded from the collection result.
      */
     CompletableFuture<List<R>> insertAllAsync(@Nullable Transaction tx, Collection<R> recs);
 
@@ -320,8 +318,8 @@ public interface RecordView<R> extends DataStreamerTarget<R>, CriteriaQuerySourc
      *
      * @param tx Transaction or {@code null} for implicit transaction.
      * @param keyRecs Records with the key columns set. The records cannot be {@code null}.
-     * @return Records with the key columns set that did not exist. The order of collection elements is guaranteed to be the same as the
-     *         order of {@code keyRecs}. If a record is removed, the element will be excluded from the collection result.
+     * @return Records with the key columns set that did not exist.
+     *         If a record is removed, the element will be excluded from the collection result.
      */
     List<R> deleteAll(@Nullable Transaction tx, Collection<R> keyRecs);
 
@@ -337,9 +335,8 @@ public interface RecordView<R> extends DataStreamerTarget<R>, CriteriaQuerySourc
      *
      * @param tx Transaction or {@code null} for implicit transaction.
      * @param keyRecs Records with the key columns set. The records cannot be {@code null}.
-     * @return Future represents the pending completion of the operation, with rejected rows for deletion in the result. The order of
-     *         collection elements is guaranteed to be the same as the order of {@code keyRecs}. If a record is removed, the element will be
-     *         excluded from the collection result.
+     * @return Future represents the pending completion of the operation, with rejected rows for deletion in the result.
+     *         If a record is removed, the element will be excluded from the collection result.
      */
     CompletableFuture<List<R>> deleteAllAsync(@Nullable Transaction tx, Collection<R> keyRecs);
 
@@ -356,8 +353,7 @@ public interface RecordView<R> extends DataStreamerTarget<R>, CriteriaQuerySourc
      *
      * @param tx Transaction or {@code null} for implicit transaction.
      * @param recs Records to delete. The records cannot be {@code null}.
-     * @return Records that were not deleted. The order of collection elements is guaranteed to be the same as the order of {@code recs}. If
-     *         a record is removed, the element will be excluded from the collection result.
+     * @return Records that were not deleted. If a record is removed, the element will be excluded from the collection result.
      */
     List<R> deleteAllExact(@Nullable Transaction tx, Collection<R> recs);
 
@@ -366,9 +362,8 @@ public interface RecordView<R> extends DataStreamerTarget<R>, CriteriaQuerySourc
      *
      * @param tx Transaction or {@code null} for implicit transaction.
      * @param recs Records to delete. The records cannot be {@code null}.
-     * @return Future represents the pending completion of the operation, with rejected rows for deletion in the result. The order of
-     *         collection elements is guaranteed to be the same as the order of {@code recs}. If a record is removed, the element will be
-     *         excluded from the collection result.
+     * @return Future represents the pending completion of the operation, with rejected rows for deletion in the result.
+     *         If a record is removed, the element will be excluded from the collection result.
      */
     CompletableFuture<List<R>> deleteAllExactAsync(@Nullable Transaction tx, Collection<R> recs);
 }
diff --git a/modules/platforms/cpp/tests/client-test/key_value_binary_view_test.cpp b/modules/platforms/cpp/tests/client-test/key_value_binary_view_test.cpp
index 3e3947e1190..9c1c892f425 100644
--- a/modules/platforms/cpp/tests/client-test/key_value_binary_view_test.cpp
+++ b/modules/platforms/cpp/tests/client-test/key_value_binary_view_test.cpp
@@ -861,10 +861,7 @@ TEST_F(key_value_binary_view_test, remove_all_nonexisting_keys_return_all) {
     EXPECT_EQ(res.size(), 2);
 
     EXPECT_EQ(1, res[0].column_count());
-    EXPECT_EQ(1, res[0].get<int64_t>("key"));
-
     EXPECT_EQ(1, res[1].column_count());
-    EXPECT_EQ(2, res[1].get<int64_t>("key"));
 }
 
 TEST_F(key_value_binary_view_test, remove_all_only_existing) {
@@ -896,10 +893,7 @@ TEST_F(key_value_binary_view_test, remove_all_overlapped) {
     EXPECT_EQ(res.size(), 2);
 
     EXPECT_EQ(1, res[0].column_count());
-    EXPECT_EQ(11, res[0].get<int64_t>("key"));
-
     EXPECT_EQ(1, res[1].column_count());
-    EXPECT_EQ(12, res[1].get<int64_t>("key"));
 }
 
 TEST_F(key_value_binary_view_test, remove_all_empty) {
@@ -913,12 +907,7 @@ TEST_F(key_value_binary_view_test, remove_all_exact_nonexisting) {
     ASSERT_EQ(2, res.size());
 
     EXPECT_EQ(2, res[0].column_count());
-    EXPECT_EQ(1, res[0].get<int64_t>("key"));
-    EXPECT_EQ("foo", res[0].get<std::string>("val"));
-
     EXPECT_EQ(2, res[1].column_count());
-    EXPECT_EQ(2, res[1].get<int64_t>("key"));
-    EXPECT_EQ("bar", res[1].get<std::string>("val"));
 }
 
 TEST_F(key_value_binary_view_test, remove_all_exact_overlapped) {
diff --git a/modules/platforms/cpp/tests/client-test/key_value_view_test.cpp b/modules/platforms/cpp/tests/client-test/key_value_view_test.cpp
index 85faebf61ee..e2e1be9d533 100644
--- a/modules/platforms/cpp/tests/client-test/key_value_view_test.cpp
+++ b/modules/platforms/cpp/tests/client-test/key_value_view_test.cpp
@@ -698,9 +698,6 @@ TEST_F(key_value_view_test, remove_all_nonexisting_keys_return_all) {
     auto res = kv_view.remove_all(nullptr, non_existing);
 
     EXPECT_EQ(res.size(), 2);
-
-    EXPECT_EQ(1, res[0].key);
-    EXPECT_EQ(2, res[1].key);
 }
 
 TEST_F(key_value_view_test, remove_all_only_existing) {
@@ -730,9 +727,6 @@ TEST_F(key_value_view_test, remove_all_overlapped) {
     auto res = kv_view.remove_all(nullptr, to_remove);
 
     EXPECT_EQ(res.size(), 2);
-
-    EXPECT_EQ(11, res[0].key);
-    EXPECT_EQ(12, res[1].key);
 }
 
 TEST_F(key_value_view_test, remove_all_empty) {
@@ -745,9 +739,6 @@ TEST_F(key_value_view_test, remove_all_exact_nonexisting) {
         nullptr, {{test_key_type(1), test_value_type("foo")}, {test_key_type(2), test_value_type("bar")}});
 
     ASSERT_EQ(2, res.size());
-
-    EXPECT_EQ(1, res[0].key);
-    EXPECT_EQ(2, res[1].key);
 }
 
 TEST_F(key_value_view_test, remove_all_exact_overlapped) {
diff --git a/modules/platforms/cpp/tests/client-test/record_binary_view_test.cpp b/modules/platforms/cpp/tests/client-test/record_binary_view_test.cpp
index dcaaf382ef5..ef26a86f3fa 100644
--- a/modules/platforms/cpp/tests/client-test/record_binary_view_test.cpp
+++ b/modules/platforms/cpp/tests/client-test/record_binary_view_test.cpp
@@ -863,10 +863,7 @@ TEST_F(record_binary_view_test, remove_all_nonexisting_keys_return_all) {
     EXPECT_EQ(res.size(), 2);
 
     EXPECT_EQ(1, res[0].column_count());
-    EXPECT_EQ(1, res[0].get<int64_t>("key"));
-
     EXPECT_EQ(1, res[1].column_count());
-    EXPECT_EQ(2, res[1].get<int64_t>("key"));
 }
 
 TEST_F(record_binary_view_test, remove_all_only_existing) {
@@ -897,10 +894,7 @@ TEST_F(record_binary_view_test, remove_all_overlapped) {
     EXPECT_EQ(res.size(), 2);
 
     EXPECT_EQ(1, res[0].column_count());
-    EXPECT_EQ(11, res[0].get<int64_t>("key"));
-
     EXPECT_EQ(1, res[1].column_count());
-    EXPECT_EQ(12, res[1].get<int64_t>("key"));
 }
 
 TEST_F(record_binary_view_test, remove_all_empty) {
@@ -914,12 +908,7 @@ TEST_F(record_binary_view_test, remove_all_exact_nonexisting) {
     ASSERT_EQ(2, res.size());
 
     EXPECT_EQ(2, res[0].column_count());
-    EXPECT_EQ(1, res[0].get<int64_t>("key"));
-    EXPECT_EQ("foo", res[0].get<std::string>("val"));
-
     EXPECT_EQ(2, res[1].column_count());
-    EXPECT_EQ(2, res[1].get<int64_t>("key"));
-    EXPECT_EQ("bar", res[1].get<std::string>("val"));
 }
 
 TEST_F(record_binary_view_test, remove_all_exact_overlapped) {
diff --git a/modules/platforms/cpp/tests/client-test/record_view_test.cpp b/modules/platforms/cpp/tests/client-test/record_view_test.cpp
index 1c605aeb1d6..586c5b0dc1e 100644
--- a/modules/platforms/cpp/tests/client-test/record_view_test.cpp
+++ b/modules/platforms/cpp/tests/client-test/record_view_test.cpp
@@ -922,9 +922,6 @@ TEST_F(record_view_test, remove_all_nonexisting_keys_return_all) {
     auto res = view.remove_all(nullptr, non_existing);
 
     EXPECT_EQ(res.size(), 2);
-
-    EXPECT_EQ(1, res[0].key);
-    EXPECT_EQ(2, res[1].key);
 }
 
 TEST_F(record_view_test, remove_all_only_existing) {
@@ -953,9 +950,6 @@ TEST_F(record_view_test, remove_all_overlapped) {
     auto res = view.remove_all(nullptr, to_remove);
 
     EXPECT_EQ(res.size(), 2);
-
-    EXPECT_EQ(11, res[0].key);
-    EXPECT_EQ(12, res[1].key);
 }
 
 TEST_F(record_view_test, remove_all_empty) {
@@ -967,9 +961,6 @@ TEST_F(record_view_test, remove_all_exact_nonexisting) {
     auto res = view.remove_all_exact(nullptr, {test_type(1, "foo"), test_type(2, "bar")});
 
     ASSERT_EQ(2, res.size());
-
-    EXPECT_EQ(1, res[0].key);
-    EXPECT_EQ(2, res[1].key);
 }
 
 TEST_F(record_view_test, remove_all_exact_overlapped) {
diff --git a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItInternalTableTest.java b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItInternalTableTest.java
index 31740d62916..c3e989fec49 100644
--- a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItInternalTableTest.java
+++ b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItInternalTableTest.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.table;
 
+import static java.util.stream.Collectors.toList;
 import static org.apache.ignite.internal.TestWrappers.unwrapIgniteImpl;
 import static org.apache.ignite.internal.TestWrappers.unwrapTableViewInternal;
 import static org.apache.ignite.internal.catalog.CatalogService.DEFAULT_STORAGE_PROFILE;
@@ -367,16 +368,13 @@ public class ItInternalTableTest extends ClusterPerClassIntegrationTest {
         assertThat(deleteAllFut, willCompleteSuccessfully());
 
         List<BinaryRow> res = deleteAllFut.join();
-
-        Iterator<BinaryRow> resIter = res.iterator();
+        List<Tuple> keyTups = res.stream().map(r -> TableRow.tuple(Row.wrapKeyOnlyBinaryRow(schemaDescriptor, r))).collect(toList());
 
         for (BinaryRowEx key : keyRows) {
-            int i = TableRow.keyTuple(Row.wrapKeyOnlyBinaryRow(schemaDescriptor, key)).<Long>value("key").intValue();
-
-            if (i % 2 == 1) {
-                Tuple rowTuple = TableRow.keyTuple(Row.wrapKeyOnlyBinaryRow(schemaDescriptor, resIter.next()));
+            Tuple tuple = TableRow.tuple(Row.wrapKeyOnlyBinaryRow(schemaDescriptor, key));
 
-                assertEquals(i % 100L, rowTuple.<Long>value("key"));
+            if (tuple.longValue("key") % 2 == 1) {
+                assertTrue(keyTups.contains(tuple));
             }
         }
     }
@@ -393,18 +391,13 @@ public class ItInternalTableTest extends ClusterPerClassIntegrationTest {
         assertThat(deleteAllExactFut, willCompleteSuccessfully());
 
         List<BinaryRow> res = deleteAllExactFut.join();
-
-        Iterator<BinaryRow> resIter = res.iterator();
+        List<Tuple> tups = res.stream().map(r -> TableRow.tuple(Row.wrapBinaryRow(schemaDescriptor, r))).collect(toList());
 
         for (BinaryRowEx key : rowsToLookup) {
-            int i = TableRow.tuple(Row.wrapBinaryRow(schemaDescriptor, key)).<Long>value("key").intValue();
-
-            if (i % 2 == 1) {
-                Tuple rowTuple = TableRow.tuple(Row.wrapBinaryRow(schemaDescriptor, resIter.next()));
+            Tuple tuple = TableRow.tuple(Row.wrapBinaryRow(schemaDescriptor, key));
 
-                assertEquals(i % 100L, rowTuple.<Long>value("key"));
-                assertEquals(i, rowTuple.<Integer>value("valInt"));
-                assertEquals("some string row" + i, rowTuple.<Integer>value("valStr"));
+            if (tuple.longValue("key") % 2 == 1) {
+                assertTrue(tups.contains(tuple));
             }
         }
     }
@@ -421,18 +414,15 @@ public class ItInternalTableTest extends ClusterPerClassIntegrationTest {
         assertThat(insertAllFut, willCompleteSuccessfully());
 
         List<BinaryRow> res = insertAllFut.join();
+        List<Tuple> tups = res.stream().map(r -> TableRow.tuple(Row.wrapBinaryRow(schemaDescriptor, r))).collect(toList());
 
-        Iterator<BinaryRow> resIter = res.iterator();
+        assertEquals(rowsToLookup.size(), res.size() * 2, "Expecting the half returned");
 
         for (BinaryRowEx key : rowsToLookup) {
-            int i = TableRow.tuple(Row.wrapBinaryRow(schemaDescriptor, key)).<Long>value("key").intValue();
+            Tuple tuple = TableRow.tuple(Row.wrapBinaryRow(schemaDescriptor, key));
 
-            if (i % 2 == 0) {
-                Tuple rowTuple = TableRow.tuple(Row.wrapBinaryRow(schemaDescriptor, resIter.next()));
-
-                assertEquals(i % 100L, rowTuple.<Long>value("key"));
-                assertEquals(i, rowTuple.<Integer>value("valInt"));
-                assertEquals("some string row" + i, rowTuple.<Integer>value("valStr"));
+            if (tuple.longValue("key") % 2 == 0) {
+                assertTrue(tups.contains(tuple));
             }
         }
     }
@@ -511,7 +501,7 @@ public class ItInternalTableTest extends ClusterPerClassIntegrationTest {
 
         var keyRows = new ArrayList<BinaryRowEx>();
 
-        for (int i = 0; i < 15; i++) {
+        for (int i = 0; i < 16; i++) {
             keyRows.add(keyOnly ? createKeyRow(i) : createKeyValueRow(i, i, "some string row" + i));
 
             if (i % 2 == 0) {
diff --git a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/UpdatableTableImpl.java b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/UpdatableTableImpl.java
index 4db9e6e9768..fe36e0acba1 100644
--- a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/UpdatableTableImpl.java
+++ b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/UpdatableTableImpl.java
@@ -23,7 +23,7 @@ import static org.apache.ignite.internal.partition.replicator.network.replicatio
 import static org.apache.ignite.internal.replicator.message.ReplicaMessageUtils.toReplicationGroupIdMessage;
 import static org.apache.ignite.internal.sql.engine.util.RowTypeUtils.rowType;
 import static org.apache.ignite.internal.sql.engine.util.TypeUtils.rowSchemaFromRelTypes;
-import static org.apache.ignite.internal.table.distributed.storage.InternalTableImpl.collectRejectedRowsResponsesWithRestoreOrder;
+import static org.apache.ignite.internal.table.distributed.storage.InternalTableImpl.collectRejectedRowsResponses;
 import static org.apache.ignite.internal.util.CollectionUtils.nullOrEmpty;
 import static org.apache.ignite.lang.ErrorGroups.Sql.CONSTRAINT_VIOLATION_ERR;
 
@@ -368,7 +368,7 @@ public final class UpdatableTableImpl implements UpdatableTable {
             ExecutionContext<RowT> ectx,
             Collection<RowBatch> batches
     ) {
-        return collectRejectedRowsResponsesWithRestoreOrder(batches)
+        return collectRejectedRowsResponses(batches)
                 .thenApply(response -> {
                     if (nullOrEmpty(response)) {
                         return null;
diff --git a/modules/table/src/main/java/org/apache/ignite/internal/table/InternalTable.java b/modules/table/src/main/java/org/apache/ignite/internal/table/InternalTable.java
index 8931812115f..4a03f68371e 100644
--- a/modules/table/src/main/java/org/apache/ignite/internal/table/InternalTable.java
+++ b/modules/table/src/main/java/org/apache/ignite/internal/table/InternalTable.java
@@ -236,9 +236,8 @@ public interface InternalTable extends ManuallyCloseable {
      *
      * @param rows Rows to insert into the table.
      * @param tx The transaction.
-     * @return Future represents the pending completion of the operation, with rejected rows for insertion in the result. The order of
-     *         collection elements is guaranteed to be the same as the order of {@code rows}. If a record is inserted, the element will be
-     *         excluded from the collection result.
+     * @return Future represents the pending completion of the operation, with rejected rows for insertion in the result.
+     *         If a record is inserted, the element will be excluded from the collection result.
      */
     CompletableFuture<List<BinaryRow>> insertAll(Collection<BinaryRowEx> rows, @Nullable InternalTransaction tx);
 
@@ -303,9 +302,8 @@ public interface InternalTable extends ManuallyCloseable {
      *
      * @param rows Rows with key columns set.
      * @param tx The transaction.
-     * @return Future represents the pending completion of the operation, with rejected rows for deletion in the result. The order of
-     *         collection elements is guaranteed to be the same as the order of {@code rows}. If a record is deleted, the element will be
-     *         excluded from the collection result.
+     * @return Future represents the pending completion of the operation, with rejected rows for deletion in the result.
+     *         If a record is deleted, the element will be excluded from the collection result.
      */
     CompletableFuture<List<BinaryRow>> deleteAll(Collection<BinaryRowEx> rows, @Nullable InternalTransaction tx);
 
@@ -314,9 +312,8 @@ public interface InternalTable extends ManuallyCloseable {
      *
      * @param rows Rows to delete.
      * @param tx The transaction.
-     * @return Future represents the pending completion of the operation, with rejected rows for deletion in the result. The order of
-     *         collection elements is guaranteed to be the same as the order of {@code rows}. If a record is deleted, the element will be
-     *         excluded from the collection result.
+     * @return Future represents the pending completion of the operation, with rejected rows for deletion in the result.
+     *         If a record is deleted, the element will be excluded from the collection result.
      */
     CompletableFuture<List<BinaryRow>> deleteAllExact(Collection<BinaryRowEx> rows, @Nullable InternalTransaction tx);
 
diff --git a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/storage/InternalTableImpl.java b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/storage/InternalTableImpl.java
index 634e484568e..5ddcd2e7a38 100644
--- a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/storage/InternalTableImpl.java
+++ b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/storage/InternalTableImpl.java
@@ -1309,7 +1309,7 @@ public class InternalTableImpl implements InternalTable {
                                 groupId,
                                 enlistmentConsistencyToken,
                                 full),
-                InternalTableImpl::collectRejectedRowsResponsesWithRestoreOrder,
+                InternalTableImpl::collectRejectedRowsResponses,
                 (res, req) -> {
                     for (BinaryRow row : res) {
                         if (row != null) {
@@ -1511,7 +1511,7 @@ public class InternalTableImpl implements InternalTable {
                 tx,
                 (keyRows0, txo, groupId, enlistmentConsistencyToken, full) ->
                         readWriteMultiRowPkReplicaRequest(RW_DELETE_ALL, keyRows0, txo, groupId, enlistmentConsistencyToken, full),
-                InternalTableImpl::collectRejectedRowsResponsesWithRestoreOrder,
+                InternalTableImpl::collectRejectedRowsResponses,
                 (res, req) -> {
                     for (BinaryRow row : res) {
                         if (row != null) {
@@ -1544,7 +1544,7 @@ public class InternalTableImpl implements InternalTable {
                                 enlistmentConsistencyToken,
                                 full
                         ),
-                InternalTableImpl::collectRejectedRowsResponsesWithRestoreOrder,
+                InternalTableImpl::collectRejectedRowsResponses,
                 (res, req) -> {
                     for (BinaryRow row : res) {
                         if (row != null) {
@@ -1942,25 +1942,28 @@ public class InternalTableImpl implements InternalTable {
      * @param rowBatches Row batches.
      * @return Future of collecting results.
      */
-    public static CompletableFuture<List<BinaryRow>> collectRejectedRowsResponsesWithRestoreOrder(Collection<RowBatch> rowBatches) {
-        return collectMultiRowsResponsesWithRestoreOrder(
-                rowBatches,
-                batch -> {
-                    List<BinaryRow> result = new ArrayList<>();
-                    List<BinaryRow> response = (List<BinaryRow>) batch.getCompletedResult();
+    public static CompletableFuture<List<BinaryRow>> collectRejectedRowsResponses(Collection<RowBatch> rowBatches) {
+        return allResultFutures(rowBatches).thenApply(ignored -> {
+            List<BinaryRow> result = new ArrayList<>();
 
-                    assert batch.requestedRows.size() == response.size() :
-                            "Replication response does not fit to request [requestRows=" + batch.requestedRows.size()
-                                    + "responseRows=" + response.size() + ']';
+            for (RowBatch batch : rowBatches) {
+                List<BinaryRow> response = (List<BinaryRow>) batch.getCompletedResult();
 
-                    for (int i = 0; i < response.size(); i++) {
-                        result.add(response.get(i) != null ? null : batch.requestedRows.get(i));
+                assert batch.requestedRows.size() == response.size() :
+                        "Replication response does not fit to request [requestRows=" + batch.requestedRows.size()
+                                + "responseRows=" + response.size() + ']';
+
+                for (int i = 0; i < response.size(); i++) {
+                    if (response.get(i) != null) {
+                        continue;
                     }
 
-                    return result;
-                },
-                true
-        );
+                    result.add(batch.requestedRows.get(i));
+                }
+            }
+
+            return result;
+        });
     }
 
     /**
diff --git a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/storage/InternalTableImplTest.java b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/storage/InternalTableImplTest.java
index 118c9cf1956..64825936c68 100644
--- a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/storage/InternalTableImplTest.java
+++ b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/storage/InternalTableImplTest.java
@@ -22,7 +22,7 @@ import static java.util.concurrent.CompletableFuture.completedFuture;
 import static org.apache.ignite.internal.lang.IgniteSystemProperties.COLOCATION_FEATURE_FLAG;
 import static org.apache.ignite.internal.lang.IgniteSystemProperties.colocationEnabled;
 import static org.apache.ignite.internal.table.distributed.storage.InternalTableImpl.collectMultiRowsResponsesWithRestoreOrder;
-import static org.apache.ignite.internal.table.distributed.storage.InternalTableImpl.collectRejectedRowsResponsesWithRestoreOrder;
+import static org.apache.ignite.internal.table.distributed.storage.InternalTableImpl.collectRejectedRowsResponses;
 import static org.apache.ignite.internal.testframework.matchers.CompletableFutureMatcher.willBe;
 import static org.apache.ignite.internal.testframework.matchers.CompletableFutureMatcher.willCompleteSuccessfully;
 import static org.apache.ignite.internal.util.CompletableFutures.nullCompletedFuture;
@@ -318,8 +318,13 @@ public class InternalTableImplTest extends BaseIgniteAbstractTest {
                 originalRows.get(4)
         );
 
+        List<RowBatch> partitionOrderBatch = new ArrayList<>();
+        partitionOrderBatch.add(rowBatchByPartitionId.get(0));
+        partitionOrderBatch.add(rowBatchByPartitionId.get(1));
+        partitionOrderBatch.add(rowBatchByPartitionId.get(2));
+
         assertThat(
-                collectRejectedRowsResponsesWithRestoreOrder(rowBatchByPartitionId.values()),
+                collectRejectedRowsResponses(partitionOrderBatch),
                 willBe(equalTo(rejectedRows))
         );
     }