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 2021/11/22 08:50:21 UTC
[GitHub] [ignite] zstan opened a new pull request #9579: IGNITE-15964 NPE in case of simultaneous cache destroy and active tx
zstan opened a new pull request #9579:
URL: https://github.com/apache/ignite/pull/9579
Thank you for submitting the pull request to the Apache Ignite.
In order to streamline the review of the contribution
we ask you to ensure the following steps have been taken:
### The Contribution Checklist
- [ ] There is a single JIRA ticket related to the pull request.
- [ ] The web-link to the pull request is attached to the JIRA ticket.
- [ ] The JIRA ticket has the _Patch Available_ state.
- [ ] The pull request body describes changes that have been made.
The description explains _WHAT_ and _WHY_ was made instead of _HOW_.
- [ ] The pull request title is treated as the final commit message.
The following pattern must be used: `IGNITE-XXXX Change summary` where `XXXX` - number of JIRA issue.
- [ ] A reviewer has been mentioned through the JIRA comments
(see [the Maintainers list](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute#HowtoContribute-ReviewProcessandMaintainers))
- [ ] The pull request has been checked by the Teamcity Bot and
the `green visa` attached to the JIRA ticket (see [TC.Bot: Check PR](https://mtcga.gridgain.com/prs.html))
### Notes
- [How to Contribute](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute)
- [Coding abbreviation rules](https://cwiki.apache.org/confluence/display/IGNITE/Abbreviation+Rules)
- [Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines)
- [Apache Ignite Teamcity Bot](https://cwiki.apache.org/confluence/display/IGNITE/Apache+Ignite+Teamcity+Bot)
If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com _#ignite_ channel.
--
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
[GitHub] [ignite] zstan commented on a change in pull request #9579: IGNITE-15964 NPE in case of simultaneous cache destroy and active tx
Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #9579:
URL: https://github.com/apache/ignite/pull/9579#discussion_r757246511
##########
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:
got it, fixed
--
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
[GitHub] [ignite] zstan commented on a change in pull request #9579: IGNITE-15964 NPE in case of simultaneous cache destroy and active tx
Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #9579:
URL: https://github.com/apache/ignite/pull/9579#discussion_r757248582
##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
##########
@@ -4569,9 +4569,9 @@ public void awaitLastFut() {
ctx.kernalContext().closure().runLocalSafe((GridPlainRunnable)() -> {
IgniteInternalFuture fut0;
- if (ctx.kernalContext().isStopping())
+ if (ctx.kernalContext().isStopping() || ctx.gate().isStopped())
fut0 = new GridFinishedFuture<>(
- new IgniteCheckedException("Operation has been cancelled (node is stopping)."));
+ new IgniteCheckedException("Operation has been cancelled (node or cache is stopping)."));
Review comment:
yep, but i prefer to store it as is.
--
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
[GitHub] [ignite] vldpyatkov commented on a change in pull request #9579: IGNITE-15964 NPE in case of simultaneous cache destroy and active tx
Posted by GitBox <gi...@apache.org>.
vldpyatkov commented on a change in pull request #9579:
URL: https://github.com/apache/ignite/pull/9579#discussion_r754928279
##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
##########
@@ -4569,9 +4569,9 @@ public void awaitLastFut() {
ctx.kernalContext().closure().runLocalSafe((GridPlainRunnable)() -> {
IgniteInternalFuture fut0;
- if (ctx.kernalContext().isStopping())
+ if (ctx.kernalContext().isStopping() || ctx.gate().isStopped())
fut0 = new GridFinishedFuture<>(
- new IgniteCheckedException("Operation has been cancelled (node is stopping)."));
+ new IgniteCheckedException("Operation has been cancelled (node or cache is stopping)."));
Review comment:
Node is stopping, but cache is stopped)
--
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
[GitHub] [ignite] vldpyatkov commented on a change in pull request #9579: IGNITE-15964 NPE in case of simultaneous cache destroy and active tx
Posted by GitBox <gi...@apache.org>.
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ignite] vldpyatkov commented on a change in pull request #9579: IGNITE-15964 NPE in case of simultaneous cache destroy and active tx
Posted by GitBox <gi...@apache.org>.
vldpyatkov commented on a change in pull request #9579:
URL: https://github.com/apache/ignite/pull/9579#discussion_r762357924
##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
##########
@@ -4569,9 +4569,9 @@ public void awaitLastFut() {
ctx.kernalContext().closure().runLocalSafe((GridPlainRunnable)() -> {
IgniteInternalFuture fut0;
- if (ctx.kernalContext().isStopping())
+ if (ctx.kernalContext().isStopping() || ctx.gate().isStopped())
fut0 = new GridFinishedFuture<>(
- new IgniteCheckedException("Operation has been cancelled (node is stopping)."));
+ new IgniteCheckedException("Operation has been cancelled (node or cache is stopping)."));
Review comment:
I think you can through exception like it is when you invoke Geateway:
```
if (ctx.gate().isStopped())
fut0 = new GridFinishedFuture<>(new CacheStoppedException(ctx.name()));
```
##########
File path: modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsDestroyCacheTest.java
##########
@@ -191,4 +215,60 @@ 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));
+
+ List<IgniteFuture<Boolean>> asyncRmFut = new ArrayList<>(100);
+
+ for (Integer pkey : pkeys)
+ asyncRmFut.add(crd.cache(DEFAULT_CACHE_NAME).removeAsync(pkey));
+
+ spi.blockMessages(GridDhtPartitionsFullMessage.class, getTestIgniteInstanceName(1));
+
+ IgniteInternalFuture destr = GridTestUtils.runAsync(() -> grid(1).destroyCache(DEFAULT_CACHE_NAME));
+
+ spi.waitForBlocked();
+
+ spi.stopBlock(true, (msg) -> msg.ioMessage().message() instanceof GridDhtPartitionsFullMessage);
+
+ spi.stopBlock();
+
+ destr.get();
+
+ assertFalse(GridTestUtils.waitForCondition(() -> G.allGrids().size() < 3, 5_000));
Review comment:
It is an antipattern, because this construction wait predefined time (5 second).
Maybe you would get rid of this assertion if handle an exception from a remove future.
```
for (IgniteFuture<Boolean> rmFut : asyncRmFut) {
try {
rmFut.get(10_000);
}
catch (Throwable ex) {
assertTrue("Unexpected exception thrown [msg=" + ex.getMessage() + ']', X.hasCause(ex,
"Failed to perform cache operation (cache is stopped): " + DEFAULT_CACHE_NAME,
CacheStoppedException.class));
}
}
```
--
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
[GitHub] [ignite] zstan commented on a change in pull request #9579: IGNITE-15964 NPE in case of simultaneous cache destroy and active tx
Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #9579:
URL: https://github.com/apache/ignite/pull/9579#discussion_r757241379
##########
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:
of course, but this test with persistence enabled )
--
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
[GitHub] [ignite] zstan closed pull request #9579: IGNITE-15964 NPE in case of simultaneous cache destroy and active tx
Posted by GitBox <gi...@apache.org>.
zstan closed pull request #9579:
URL: https://github.com/apache/ignite/pull/9579
--
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