This is an automated email from the ASF dual-hosted git repository.
timoninmaxim pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new 75efe3d48a3 IGNITE-19281 Fix flaky IgniteSnapshotMXBeanTest#testStatus
(#10646)
75efe3d48a3 is described below
commit 75efe3d48a3c6b0cd1c2c8e285c4f661dd99c3e3
Author: Maksim Timonin <[email protected]>
AuthorDate: Mon Apr 17 15:24:04 2023 +0300
IGNITE-19281 Fix flaky IgniteSnapshotMXBeanTest#testStatus (#10646)
---
.../cache/persistence/snapshot/SnapshotRestoreProcess.java | 9 ++-------
.../cache/persistence/snapshot/IgniteSnapshotMXBeanTest.java | 4 ++++
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotRestoreProcess.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotRestoreProcess.java
index 12f9f0c54f2..508ae7e2ba9 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotRestoreProcess.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotRestoreProcess.java
@@ -290,7 +290,7 @@ public class SnapshotRestoreProcess {
throw new IgniteException(OP_REJECT_MSG + "A cluster snapshot
operation is in progress.");
synchronized (this) {
- if (restoringSnapshotName() != null)
+ if (restoringSnapshotName() != null || fut != null)
throw new IgniteException(OP_REJECT_MSG + "The previous
snapshot restore operation was not completed.");
fut = new ClusterSnapshotFuture(UUID.randomUUID(), snpName,
incIdx);
@@ -437,12 +437,7 @@ public class SnapshotRestoreProcess {
public @Nullable String restoringSnapshotName() {
SnapshotRestoreContext opCtx0 = opCtx;
- if (opCtx0 != null)
- return opCtx0.snpName;
-
- ClusterSnapshotFuture fut0 = fut;
-
- return fut0 != null ? fut0.name : null;
+ return opCtx0 == null ? null : opCtx0.snpName;
}
/**
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotMXBeanTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotMXBeanTest.java
index 375ec60ccd2..91b88a45461 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotMXBeanTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotMXBeanTest.java
@@ -260,6 +260,8 @@ public class IgniteSnapshotMXBeanTest extends
AbstractSnapshotSelfTest {
// Restore full snapshot.
srv.destroyCache(DEFAULT_CACHE_NAME);
+ awaitPartitionMapExchange();
+
spi.blockMessages((node, msg) -> msg instanceof SingleNodeMessage);
fut = srv.snapshot().restoreSnapshot(SNAPSHOT_NAME,
F.asList(DEFAULT_CACHE_NAME));
@@ -279,6 +281,8 @@ public class IgniteSnapshotMXBeanTest extends
AbstractSnapshotSelfTest {
if (!encryption) {
srv.destroyCache(DEFAULT_CACHE_NAME);
+ awaitPartitionMapExchange();
+
spi.blockMessages((node, msg) -> msg instanceof SingleNodeMessage);
fut = srv.snapshot().restoreSnapshot(SNAPSHOT_NAME,
F.asList(DEFAULT_CACHE_NAME), 1);