This is an automated email from the ASF dual-hosted git repository. ppa 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 593319d1204 IGNITE-17552 Fixed an issue where the snapshot error was not propagated to the initiating node (#10221) 593319d1204 is described below commit 593319d1204ab79dadacc0e08c84c4f519d36ba1 Author: Pavel Pereslegin <xxt...@gmail.com> AuthorDate: Tue Aug 30 15:57:53 2022 +0300 IGNITE-17552 Fixed an issue where the snapshot error was not propagated to the initiating node (#10221) --- .../snapshot/IgniteSnapshotManager.java | 5 ++- .../snapshot/IgniteClusterSnapshotSelfTest.java | 36 ++++++++++++++++++++-- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java index 322293573db..b339b62184d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java @@ -976,8 +976,11 @@ public class IgniteSnapshotManager extends GridCacheSharedManagerAdapter return new GridFinishedFuture<>(); try { - if (req.error() != null) + if (req.error() != null) { + snpReq.error(req.error()); + deleteSnapshot(snapshotLocalDir(req.snapshotName(), req.snapshotPath()), pdsSettings.folderName()); + } removeLastMetaStorageKey(); } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotSelfTest.java index 3342619fe38..cffa3156c4d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotSelfTest.java @@ -36,6 +36,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.BiFunction; +import java.util.function.Consumer; import java.util.function.Predicate; import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; @@ -48,6 +49,7 @@ import org.apache.ignite.cache.query.ScanQuery; import org.apache.ignite.cluster.ClusterTopologyException; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; +import org.apache.ignite.internal.GridKernalContext; import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.IgniteInterruptedCheckedException; @@ -98,6 +100,7 @@ import static org.apache.ignite.internal.processors.cache.persistence.snapshot.I import static org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager.resolveSnapshotWorkDirectory; import static org.apache.ignite.testframework.GridTestUtils.assertThrowsAnyCause; import static org.apache.ignite.testframework.GridTestUtils.assertThrowsWithCause; +import static org.apache.ignite.testframework.GridTestUtils.waitForCondition; /** * Cluster-wide snapshot test. @@ -759,6 +762,35 @@ public class IgniteClusterSnapshotSelfTest extends AbstractSnapshotSelfTest { } } + /** @throws Exception If fails. */ + @Test + public void testClusterSnapshotWithExplicitPathError() throws Exception { + startGridsWithCache(2, dfltCacheCfg, 0); + + String invalidPath = "/" + (char)0; + + Consumer<Integer> check = idx -> { + GridKernalContext kctx = grid(idx).context(); + + assertThrowsAnyCause(log, + () -> kctx.cache().context().snapshotMgr().createSnapshot(SNAPSHOT_NAME, invalidPath).get(TIMEOUT), + IgniteCheckedException.class, + invalidPath); + + ObjectGauge<String> err = kctx.metric().registry(SNAPSHOT_METRICS).findMetric("LastSnapshotErrorMessage"); + + assertTrue(err.value().contains(invalidPath)); + }; + + // Check on coordinator. + check.accept(0); + + waitForCondition(() -> !grid(1).context().cache().context().snapshotMgr().isSnapshotCreating(), TIMEOUT); + + // Check on non-coordinator. + check.accept(1); + } + /** @throws Exception If fails. */ @Test public void testClusterSnapshotMetrics() throws Exception { @@ -1020,8 +1052,8 @@ public class IgniteClusterSnapshotSelfTest extends AbstractSnapshotSelfTest { assertThrowsAnyCause(log, fut::get, - IgniteException.class, - "Snapshot creation has been finished with an error"); + ClusterTopologyException.class, + "Snapshot operation interrupted, because baseline node left the cluster."); assertEquals("Snapshot futures expected: " + exchFuts, 3, exchFuts.size());