ibessonov commented on code in PR #7489:
URL: https://github.com/apache/ignite-3/pull/7489#discussion_r2740823147


##########
modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/mv/PersistentPageMemoryMvPartitionStorageConcurrencyTest.java:
##########
@@ -96,4 +105,51 @@ protected void tearDown() throws Exception {
                 engine == null ? null : engine::stop
         );
     }
+
+    /**
+     * Reproducer for a <a 
href="https://issues.apache.org/jira/browse/IGNITE-27638";>corrupted Write 
Intent list</a>.
+     * During replace of the value found both in inner and leaf nodes of 
VersionChain tree, we tried to remove WI from the WI list twice.
+     * If neighboring WI in the WI double-linked list was invalidated between 
these removals, we would get an exception trying to access it
+     * to change its links.
+     *
+     * <p>Test builds a 3-level tree, and creates a race between aborting B 
and D write intents. WI are large, so they don't share the same
+     * page.
+     *                B
+     *               / \
+     *             A   C
+     *           / \   | \
+     *          A  B   C  D
+     */
+    @Test
+    void testAbortWriteIntentsListRace() throws IgniteInternalCheckedException 
{
+        // Build a 3-level tree.
+        int rowsCount = 50_000;
+        UUID txId = newTransactionId();
+        RowId[] rowIds = new RowId[rowsCount];
+
+        for (int i = 0; i < rowsCount; i++) {
+            rowIds[i] = new RowId(PARTITION_ID, i, i);
+            addWriteCommitted(rowIds[i], TABLE_ROW, HybridTimestamp.MAX_VALUE);
+        }
+
+        VersionChainTree versionChainTree = 
((PersistentPageMemoryMvPartitionStorage) 
storage).renewableState.versionChainTree();
+
+        // Assert that the tree has 3 levels, first level is 0.
+        assertThat((versionChainTree.rootLevel()), is(2));

Review Comment:
   ```suggestion
           assertThat(versionChainTree.rootLevel(), is(2));
   ```



##########
modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/mv/PersistentPageMemoryMvPartitionStorageConcurrencyTest.java:
##########
@@ -96,4 +105,51 @@ protected void tearDown() throws Exception {
                 engine == null ? null : engine::stop
         );
     }
+
+    /**
+     * Reproducer for a <a 
href="https://issues.apache.org/jira/browse/IGNITE-27638";>corrupted Write 
Intent list</a>.
+     * During replace of the value found both in inner and leaf nodes of 
VersionChain tree, we tried to remove WI from the WI list twice.
+     * If neighboring WI in the WI double-linked list was invalidated between 
these removals, we would get an exception trying to access it
+     * to change its links.
+     *
+     * <p>Test builds a 3-level tree, and creates a race between aborting B 
and D write intents. WI are large, so they don't share the same
+     * page.
+     *                B
+     *               / \
+     *             A   C
+     *           / \   | \
+     *          A  B   C  D

Review Comment:
   Please format it as a code, so that in HTML/rendered javadoc it would still 
look nice. Thank you!



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