ygerzhedovich commented on code in PR #990:
URL: https://github.com/apache/ignite-3/pull/990#discussion_r947888633


##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/api/ItSqlSynchronousApiTest.java:
##########
@@ -181,13 +184,100 @@ public void dml() {
 
         var states = (Map<UUID, TxState>) 
IgniteTestUtils.getFieldValue(txManagerInternal, TxManagerImpl.class, "states");
 
-        states.forEach((k, v) -> assertNotSame(v, TxState.PENDING));
+        assertTrue(waitForCondition(() -> states.values().stream().noneMatch(e 
-> e.equals(TxState.PENDING)), 5_000));
 
         checkDml(ROW_COUNT, ses, "UPDATE TEST SET VAL0 = VAL0 + ?", 1);
 
         checkDml(ROW_COUNT, ses, "DELETE FROM TEST WHERE VAL0 >= 0");
     }
 
+    /**
+     * Execute concurrent insertion batch of equal pk`s and different val`s.
+     * Check sum of arithmetic progression as a confirmation that only one 
batch has been commited.
+     */
+    @Test
+    public void concurrentInsertOfHugeDataWithEqPkeys() {
+        sql("CREATE TABLE TEST(ID INT PRIMARY KEY, NUMERIC INT)");
+
+        IgniteSql sql = igniteSql();
+
+        IntStream range1 = IntStream.range(0, 10 * MODIFY_BATCH_SIZE);
+
+        IntStream range2 = IntStream.range(10 * MODIFY_BATCH_SIZE, 20 * 
MODIFY_BATCH_SIZE);
+
+        // arithmetic progression sum.
+        int s1 = ((0 + 10 * MODIFY_BATCH_SIZE - 1) * 10 * MODIFY_BATCH_SIZE) / 
2;
+
+        // arithmetic progression sum.
+        int s2 = ((10 * MODIFY_BATCH_SIZE + 20 * MODIFY_BATCH_SIZE - 1) * 10 * 
MODIFY_BATCH_SIZE) / 2;
+
+        int[] arr1 = range1.toArray();
+
+        CompletableFuture<?> fut1 = runAsync(() -> {
+            Session ses = sql.createSession();

Review Comment:
   let's use try with resource here
   try (Session ses = sql.createSession()) {



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