You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2022/11/23 10:45:04 UTC

[GitHub] [ignite-3] denis-chudov commented on a diff in pull request #1359: IGNITE-18165 Applied short term locks to sorted indexes

denis-chudov commented on code in PR #1359:
URL: https://github.com/apache/ignite-3/pull/1359#discussion_r1030249934


##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItTableScanTest.java:
##########
@@ -0,0 +1,247 @@
+/*
+ * 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.internal.table;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.Flow.Publisher;
+import java.util.concurrent.Flow.Subscriber;
+import java.util.concurrent.Flow.Subscription;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.stream.IntStream;
+import org.apache.ignite.internal.app.IgniteImpl;
+import org.apache.ignite.internal.schema.BinaryRow;
+import org.apache.ignite.internal.schema.configuration.TablesConfiguration;
+import org.apache.ignite.internal.sql.engine.AbstractBasicIntegrationTest;
+import org.apache.ignite.internal.testframework.IgniteTestUtils;
+import org.apache.ignite.lang.IgniteStringFormatter;
+import org.apache.ignite.table.Tuple;
+import org.jetbrains.annotations.NotNull;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Tests to check a scan internal command.
+ */
+public class ItTableScanTest extends AbstractBasicIntegrationTest {
+
+    /** Table name. */
+    private static final String TABLE_NAME = "test";
+
+    /** Sorted index name. */
+    public static final String SORTED_IDX = "sorted_idx";
+
+    /** Ids to insert. */
+    private static final List<Integer> ROW_IDS = List.of(1, 2, 5, 6, 7, 10, 53);
+
+    @BeforeEach
+    public void beforeTest() {
+        TableImpl table = getOrCreateTable();
+
+        loadData(table);
+    }
+
+    @AfterEach
+    public void afterTest() {
+        clearData(getOrCreateTable());
+    }
+
+    @Test
+    public void testInsertWaitScanComplete() throws Exception {
+        TableImpl table = getOrCreateTable();
+
+        InternalTable internalTable = table.internalTable();
+
+        UUID soredIndexId = getSortedIndexId();

Review Comment:
   `sortedIndexId`



##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java:
##########
@@ -1435,9 +1452,15 @@ private CompletableFuture<Object> processSingleEntryAction(ReadWriteSingleRowRep
                     RowId rowId0 = new RowId(partId);
 
                     return takeLocksForInsert(searchRow, rowId0, txId)
-                            .thenCompose(ignored -> applyCmdWithExceptionHandling(
-                                    updateCommand(commitPartitionId, rowId0.uuid(), searchRow.byteBuffer(), txId)))
-                            .thenApply(ignored -> true);
+                            .thenCompose(rowIdLock -> applyCmdWithExceptionHandling(
+                                    updateCommand(commitPartitionId, rowId0.uuid(), searchRow.byteBuffer(), txId))
+                                    .thenApply(ignored -> rowIdLock))

Review Comment:
   could you pls fix indentation so that `thenApply` wouldn't be under `updateCommand` which it is not related to? Here and below are 6 similar cases



-- 
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-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org