vldpyatkov commented on a change in pull request #9579:
URL: https://github.com/apache/ignite/pull/9579#discussion_r756616028



##########
File path: 
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsDestroyCacheTest.java
##########
@@ -191,4 +211,53 @@ private void 
doTestDestroyCacheOperationNotBlockingCheckpointTest(boolean loc) t
 
         fut.get();
     }
+
+    /**
+     * Tests correctness of concurrent cache destroy and implicit tx`s.
+     */
+    @Test
+    public void cacheDestroyWithConcImplicitTx() throws Exception {
+        final IgniteEx crd = (IgniteEx)startGridsMultiThreaded(3);
+
+        crd.cluster().state(ClusterState.ACTIVE);
+
+        crd.createCache(new CacheConfiguration(DEFAULT_CACHE_NAME)
+            
.setBackups(1).setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL).setGroupName("test"));
+
+        crd.createCache(new CacheConfiguration(DEFAULT_CACHE_NAME + "_1")
+            
.setBackups(1).setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL).setGroupName("test"));
+
+        Set<Integer> pkeys = new TreeSet<>();
+        try (final IgniteDataStreamer<Object, Object> streamer = 
crd.dataStreamer(DEFAULT_CACHE_NAME)) {
+            for (int i = 0; i < 100; i++) {
+                streamer.addData(i, i);
+
+                if 
(crd.affinity(DEFAULT_CACHE_NAME).isPrimary(crd.localNode(), i))
+                    pkeys.add(i);
+            }
+        }
+
+        TestRecordingCommunicationSpi spi = 
TestRecordingCommunicationSpi.spi(crd);
+
+        spi.blockMessages(GridDhtTxPrepareRequest.class, 
getTestIgniteInstanceName(1));
+
+        for (Integer pkey : pkeys)
+            crd.cache(DEFAULT_CACHE_NAME).removeAsync(pkey);
+
+        spi.waitForBlocked();
+
+        spi.blockMessages(GridDhtPartitionsFullMessage.class, 
getTestIgniteInstanceName(1));
+
+        IgniteInternalFuture destr = GridTestUtils.runAsync(() -> 
grid(1).destroyCache(DEFAULT_CACHE_NAME));
+
+        spi.waitForBlocked();

Review comment:
       You already have blocked messages before, this method always returns 
true here.
   Maybe the block of FullMessage does not require for the test.

##########
File path: 
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsDestroyCacheTest.java
##########
@@ -191,4 +211,53 @@ private void 
doTestDestroyCacheOperationNotBlockingCheckpointTest(boolean loc) t
 
         fut.get();
     }
+
+    /**
+     * Tests correctness of concurrent cache destroy and implicit tx`s.
+     */
+    @Test
+    public void cacheDestroyWithConcImplicitTx() throws Exception {
+        final IgniteEx crd = (IgniteEx)startGridsMultiThreaded(3);
+
+        crd.cluster().state(ClusterState.ACTIVE);
+
+        crd.createCache(new CacheConfiguration(DEFAULT_CACHE_NAME)
+            
.setBackups(1).setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL).setGroupName("test"));
+
+        crd.createCache(new CacheConfiguration(DEFAULT_CACHE_NAME + "_1")
+            
.setBackups(1).setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL).setGroupName("test"));
+
+        Set<Integer> pkeys = new TreeSet<>();
+        try (final IgniteDataStreamer<Object, Object> streamer = 
crd.dataStreamer(DEFAULT_CACHE_NAME)) {
+            for (int i = 0; i < 100; i++) {
+                streamer.addData(i, i);
+
+                if 
(crd.affinity(DEFAULT_CACHE_NAME).isPrimary(crd.localNode(), i))
+                    pkeys.add(i);
+            }
+        }
+
+        TestRecordingCommunicationSpi spi = 
TestRecordingCommunicationSpi.spi(crd);
+
+        spi.blockMessages(GridDhtTxPrepareRequest.class, 
getTestIgniteInstanceName(1));
+
+        for (Integer pkey : pkeys)
+            crd.cache(DEFAULT_CACHE_NAME).removeAsync(pkey);

Review comment:
       I worry about you do not wait to finish these deletions in the end of 
the test.

##########
File path: 
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsDestroyCacheTest.java
##########
@@ -191,4 +211,53 @@ private void 
doTestDestroyCacheOperationNotBlockingCheckpointTest(boolean loc) t
 
         fut.get();
     }
+
+    /**
+     * Tests correctness of concurrent cache destroy and implicit tx`s.
+     */
+    @Test
+    public void cacheDestroyWithConcImplicitTx() throws Exception {
+        final IgniteEx crd = (IgniteEx)startGridsMultiThreaded(3);
+
+        crd.cluster().state(ClusterState.ACTIVE);

Review comment:
       Activation is not necessary for in-memory cluster.




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