Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
eb6273c
neuroslop
Vladsz83 Sep 7, 2026
d9aa470
IGNITE-29037 Refactored Message Factory usage in TCP Discovery implem…
petrov-mg Sep 4, 2026
7042aec
raw
Vladsz83 Sep 7, 2026
682a21c
raw
Vladsz83 Sep 7, 2026
bcc72c4
Merge branch 'master' into support-snapshot-lists
Vladsz83 Sep 7, 2026
3ab443a
raw
Vladsz83 Sep 8, 2026
9171c7e
raw
Vladsz83 Sep 8, 2026
de68328
+ snpPath
Vladsz83 Sep 9, 2026
f0996e9
better tests
Vladsz83 Sep 9, 2026
80c7644
own test
Vladsz83 Sep 9, 2026
c8d1c25
Merge branch 'master' into snp-delete
Vladsz83 Sep 9, 2026
fc11a5f
+ test
Vladsz83 Sep 10, 2026
8a007e3
Simplification
Vladsz83 Sep 10, 2026
97ab26c
+ restore test
Vladsz83 Sep 10, 2026
fbb2cf8
+ create test
Vladsz83 Sep 10, 2026
2ed26ad
reimpl tests
Vladsz83 Sep 10, 2026
9b0e5ff
better IgniteClusterSnapshotDeleteTest
Vladsz83 Sep 10, 2026
b09e0b3
+incr test
Vladsz83 Sep 10, 2026
71717c2
raw
Vladsz83 Sep 10, 2026
7148da6
+ feature support test
Vladsz83 Sep 10, 2026
d36c642
+ IgniteClusterSnapshotDeleteTest
Vladsz83 Sep 10, 2026
9a658df
fix
Vladsz83 Sep 11, 2026
35a4c9d
Merge branch 'master' into Introduce-snapshot-deletion-command
Vladsz83 Sep 11, 2026
d715c66
test fix + doc
Vladsz83 Sep 11, 2026
e6aa330
+ RU test. + many small fixes.
Vladsz83 Sep 11, 2026
4233322
review fixes
Vladsz83 Sep 11, 2026
b11f389
test fix
Vladsz83 Sep 14, 2026
37cb071
Merge branch 'master' into IGNITE-29050-Introduce-snapshot-deletion-c…
Vladsz83 Sep 14, 2026
f00d266
+ tests
Vladsz83 Sep 14, 2026
57909f4
+ tests
Vladsz83 Sep 14, 2026
edd86d7
Merge branch 'master' into Introduce-snapshot-deletion-command
Vladsz83 Sep 15, 2026
7e82295
+ delete-deletePath test
Vladsz83 Sep 15, 2026
ed9cc3a
+ another delete-deletePath tests
Vladsz83 Sep 15, 2026
bb1dfec
+ test pf deletion repeat on restarted offline node
Vladsz83 Sep 15, 2026
129b090
+ stop-node test, fixes
Vladsz83 Sep 15, 2026
4249205
revert delete cancel flag
Vladsz83 Sep 15, 2026
b7c182d
+ RU test
Vladsz83 Sep 16, 2026
a67c484
Merge branch 'master' into IGNITE-29050-Introduce-snapshot-deletion-c…
Vladsz83 Sep 17, 2026
a0425cb
+ raw testDeletionInIgnite
Vladsz83 Sep 18, 2026
d30d4f9
in-ignite deleteion test fix
Vladsz83 Sep 18, 2026
852904f
Major fix of testDeleteNotSnapshotSharedDirectory(), reimpl of snp tr…
Vladsz83 Sep 18, 2026
f416646
+ delete tests .Checkstyle
Vladsz83 Sep 21, 2026
bb9d486
- all in node tree
Vladsz83 Sep 21, 2026
eae0892
better delete tests
Vladsz83 Sep 21, 2026
c04edd7
fixes
Vladsz83 Sep 21, 2026
6596432
test fixes, fixes
Vladsz83 Sep 21, 2026
4977c26
test fixes, fixes
Vladsz83 Sep 21, 2026
3da6b6a
review fixes, checkstyle.
Vladsz83 Sep 22, 2026
6c076ae
fixes
Vladsz83 Sep 22, 2026
0f09da9
+ baseline check and warning
Vladsz83 Sep 22, 2026
219c572
+ baseline check and warning
Vladsz83 Sep 22, 2026
d8ce7d8
review fixes
Vladsz83 Sep 22, 2026
ab3043c
Merge remote-tracking branch 'my/Introduce-snapshot-deletion-command'…
Vladsz83 Sep 22, 2026
95bc7a1
fixes
Vladsz83 Sep 22, 2026
501a6b9
ru fixes
Vladsz83 Sep 22, 2026
23fe41c
ru fixes
Vladsz83 Sep 22, 2026
0e96740
doc fix
Vladsz83 Sep 22, 2026
204acaa
+ corrupted metafile test
Vladsz83 Sep 22, 2026
e6086d6
manual review, review fixes
Vladsz83 Sep 22, 2026
d4c7e88
test fixes
Vladsz83 Sep 22, 2026
2b2cc21
flaky fixes
Vladsz83 Sep 23, 2026
b1e8d98
+ doc, + test fix
Vladsz83 Sep 23, 2026
9d493a0
doc fix
Vladsz83 Sep 23, 2026
1dd3d53
fix of the confirmation promt.
Vladsz83 Sep 23, 2026
2092624
review fixes
Vladsz83 Sep 24, 2026
0dd70d4
review fix
Vladsz83 Sep 24, 2026
3b0da46
review fix
Vladsz83 Sep 24, 2026
be040de
revert test
Vladsz83 Sep 24, 2026
1f5ffbc
Merge branch 'master' into IGNITE-29050-Introduce-snapshot-deletion-c…
Vladsz83 Sep 24, 2026
045ad6a
Merge branch 'master' into IGNITE-29050-Introduce-snapshot-deletion-c…
Vladsz83 Sep 24, 2026
4a0f8b2
review fixes
Vladsz83 Sep 24, 2026
b3f1213
review fixes
Vladsz83 Sep 24, 2026
b4af64c
Merge remote-tracking branch 'my/Introduce-snapshot-deletion-command'…
Vladsz83 Sep 25, 2026
67122e0
review fixes
Vladsz83 Sep 25, 2026
6fe41e1
review fixes
Vladsz83 Sep 25, 2026
e4ae1db
- sync
Vladsz83 Sep 25, 2026
ddf9c1c
review fix
Vladsz83 Sep 25, 2026
4a29b49
review fixes
Vladsz83 Sep 25, 2026
e491071
review fixes
Vladsz83 Sep 25, 2026
16cc24c
review fixes
Vladsz83 Sep 25, 2026
6d05812
review fixes
Vladsz83 Sep 25, 2026
c14969e
+ RU task test
Vladsz83 Sep 25, 2026
e01aadf
+ character case name tests
Vladsz83 Sep 28, 2026
b887fcd
fixes
Vladsz83 Sep 28, 2026
8db6b4a
review fixes
Vladsz83 Sep 28, 2026
4c16a2c
Merge remote-tracking branch 'my/Introduce-snapshot-deletion-command'…
Vladsz83 Sep 28, 2026
e22ddf7
review fixes
Vladsz83 Sep 28, 2026
5ea197b
revert todo
Vladsz83 Sep 28, 2026
13c0bca
+ permissions test
Vladsz83 Sep 28, 2026
f2a334c
fix
Vladsz83 Sep 28, 2026
49394b4
minorFix
Vladsz83 Sep 29, 2026
fe4233a
Merge branch 'master' into IGNITE-29050-Introduce-snapshot-deletion-c…
Vladsz83 Sep 29, 2026
ca00377
review fixes
Vladsz83 Sep 29, 2026
09c7d22
review fixes
Vladsz83 Sep 29, 2026
ba9227c
review fixes
Vladsz83 Sep 29, 2026
e65eccd
Merge remote-tracking branch 'my/Introduce-snapshot-deletion-command'…
Vladsz83 Sep 29, 2026
2c33f79
review fixes, + test in progress
Vladsz83 Sep 30, 2026
e6f3bf4
review fixes
Vladsz83 Sep 30, 2026
fcc642a
test fix
Vladsz83 Sep 30, 2026
62daf8e
review fix
Vladsz83 Sep 30, 2026
c833335
review fixes
Vladsz83 Sep 30, 2026
18d69db
review fixes
Vladsz83 Sep 30, 2026
df5f108
Merge branch 'master' into Introduce-snapshot-deletion-command
Vladsz83 Sep 30, 2026
40eb537
test fixes
Vladsz83 Sep 30, 2026
142b32c
test simplification
Vladsz83 Sep 30, 2026
fb42198
review fixes
Vladsz83 Sep 30, 2026
e162fda
Merge branch 'master' into IGNITE-29050-Introduce-snapshot-deletion-c…
Vladsz83 Sep 30, 2026
b3582fe
Merge branch 'master' into IGNITE-29050-Introduce-snapshot-deletion-c…
Vladsz83 Sep 30, 2026
4c85930
Merge remote-tracking branch 'my/Introduce-snapshot-deletion-command'…
Vladsz83 Sep 30, 2026
7e5bf2d
+ master, review fixes
Vladsz83 Sep 30, 2026
4b4a156
improve
Vladsz83 Sep 30, 2026
63426cb
fixes
Vladsz83 Oct 1, 2026
7147213
review fixes
Vladsz83 Oct 1, 2026
5e9682e
review fixes
Vladsz83 Oct 1, 2026
3016b67
Merge branch 'master' into IGNITE-29050-Introduce-snapshot-deletion-c…
Vladsz83 Oct 1, 2026
54e7574
test fixes
Vladsz83 Oct 1, 2026
d7f2d75
Merge branch 'master' into IGNITE-29050-Introduce-snapshot-deletion-c…
Vladsz83 Oct 1, 2026
233e0ab
copilot review fixes
Vladsz83 Oct 1, 2026
58c28a7
Merge remote-tracking branch 'my/Introduce-snapshot-deletion-command'…
Vladsz83 Oct 1, 2026
722ba31
fix
Vladsz83 Oct 1, 2026
877496b
fix
Vladsz83 Oct 1, 2026
20998d4
revert mistaken deletion cycle processing
Vladsz83 Oct 2, 2026
6303876
Merge branch 'master' into IGNITE-29050-Introduce-snapshot-deletion-c…
Vladsz83 Oct 2, 2026
c2f1e13
Merge remote-tracking branch 'my/Introduce-snapshot-deletion-command'…
Vladsz83 Oct 2, 2026
0fd27b9
Merge branch 'master' into IGNITE-29050-Introduce-snapshot-deletion-c…
Vladsz83 Oct 2, 2026
268a42a
RU tests fixes
Vladsz83 Oct 2, 2026
b7fb4e5
Merge branch 'master' into Introduce-snapshot-deletion-command
Vladsz83 Oct 2, 2026
44280e2
deepseek review fixes
Vladsz83 Oct 2, 2026
bc18ebd
compilation fix
Vladsz83 Oct 3, 2026
d2d869e
compile fix
Vladsz83 Oct 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions docs/_docs/snapshots/snapshots.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,50 @@ control.(sh|bat) --snapshot restore snapshot_09062021 --groups cache-group1,cach
control.(sh|bat) --snapshot restore snapshot_09062021 --increment 1
----

== Deleting Snapshot

You can delete a snapshot using the `control.sh|bat` script.

The deletion is performed on all *online* server nodes of the cluster.
[NOTE]
====
The snapshot integrity, topology and correctness aren't checked. Snapshot data on offline server nodes aren't deleted.
====

[tabs]
--
tab:Unix[]
[source,shell]
----
# Delete the snapshot "snapshot_09062021".
control.sh --snapshot delete snapshot_09062021

# Delete the snapshot "snapshot_09062021" located in the "/tmp/ignite/snapshots" folder.
control.sh --snapshot delete snapshot_09062021 --src /tmp/ignite/snapshots
----

tab:Windows[]
[source,shell]
----
# Delete the snapshot "snapshot_09062021".
control.bat --snapshot delete snapshot_09062021

# Delete the snapshot "snapshot_09062021" located in the "C:\tmp\ignite\snapshots" folder.
control.bat --snapshot delete snapshot_09062021 --src C:\tmp\ignite\snapshots
----
--

=== Delete operation limitations
Comment thread
Vladsz83 marked this conversation as resolved.

The delete operation is subject to the following limitations:

* The deletion is rejected if any snapshot operation (create, restore, check, delete) is active for the snapshot.
* The operation requires the snapshot administration permissions via `IgniteSecurity` (if configured).
* The operation cannot be undone and the deleted snapshot cannot be restored. The command prompts for a confirmation.
* Before deletion, no validation is performed on the snapshot other than locating and reading its metadata.
If the metadata isn't found or cannot be read, snapshot isn't deleted.
* The deletion operation is independent of the status of the snapshot operation and cancellation requests.
Comment thread
zstan marked this conversation as resolved.

== Getting Snapshot Operation Status

The status of the current snapshot operation in the cluster can be obtained using the `control.sh|bat` script or JMX interface:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public static List<RelHint> nonInheritedRelHints(RelNode rel) {

/**
* @return Distinct hints within {@code hints} filtered with {@code hintDefs}, {@link HintOptionsChecker} and
* removed inherit pathes.
* removed inherit paths.
* @see HintOptionsChecker
* @see RelHint#inheritPath
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public static IgniteRel optimize(SqlNode sqlNode, IgnitePlanner planner, IgniteL
rel = planner.trimUnusedFields(root.withRel(rel)).rel;

// The following pushed down project can erase top-level hints. We store them to reassign hints for join nodes.
// Clear the inherit pathes to consider the hints as not propogated ones.
// Clear the inherit paths to consider the hints as not propagated ones.
List<RelHint> topHints = HintUtils.allRelHints(rel).stream().map(h -> h.inheritPath.isEmpty()
? h
: h.copy(Collections.emptyList())).collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
import org.apache.ignite.internal.management.performancestatistics.PerformanceStatisticsCommand;
import org.apache.ignite.internal.management.property.PropertyCommand;
import org.apache.ignite.internal.management.snapshot.SnapshotCommand;
import org.apache.ignite.internal.management.snapshot.SnapshotDeleteCommand;
import org.apache.ignite.internal.management.snapshot.SnapshotRestoreCommand;
import org.apache.ignite.internal.management.tx.TxCommand;
import org.apache.ignite.internal.management.tx.TxCommandArg;
Expand Down Expand Up @@ -529,6 +530,8 @@ else if (cmd.getClass() == EncryptionChangeCacheKeyCommand.class)
cmdText = F.concat(cmdText, "cacheGroup1");
else if (cmd.getClass() == SnapshotRestoreCommand.class)
cmdText = F.concat(cmdText, "snp1");
else if (cmd.getClass() == SnapshotDeleteCommand.class)
cmdText = F.concat(cmdText, "snp1");
else if (cmd.getClass() == MetaUpdateCommand.class)
return;
else if (cmd.getClass() == MetaRemoveCommand.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.apache.ignite.util.GridCommandHandlerCheckpointTest;
import org.apache.ignite.util.GridCommandHandlerClusterByClassTest;
import org.apache.ignite.util.GridCommandHandlerClusterByClassWithSSLTest;
import org.apache.ignite.util.GridCommandHandlerDeleteSnapshotTest;
import org.apache.ignite.util.GridCommandHandlerIncompatibleSslConfigTest;
import org.apache.ignite.util.GridCommandHandlerIndexingCheckSizeTest;
import org.apache.ignite.util.GridCommandHandlerIndexingClusterByClassTest;
Expand Down Expand Up @@ -74,6 +75,7 @@
GridCommandHandlerCheckIndexesInlineSizeTest.class,
GridCommandHandlerMetadataTest.class,
GridCommandHandlerCheckIncrementalSnapshotTest.class,
GridCommandHandlerDeleteSnapshotTest.class,
GridCommandHandlerLegacyClientTest.class,

KillCommandsControlShTest.class,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.ignite.testsuites;

import org.apache.ignite.util.GridCommandHandlerDeleteSnapshotTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;

/**
* Test suite for control utility.
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({
GridCommandHandlerDeleteSnapshotTest.class
})
public class IgniteControlUtilityTestSuite6 {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,240 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.ignite.util;

import java.io.File;
import java.nio.file.DirectoryStream;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Collection;
import org.apache.ignite.IgniteDataStreamer;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.management.snapshot.SnapshotDeleteCommand;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.testframework.GridTestUtils;
import org.junit.Test;
import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;

import static java.nio.file.Files.newDirectoryStream;
import static org.apache.ignite.cluster.ClusterState.ACTIVE;
import static org.apache.ignite.internal.commandline.CommandHandler.EXIT_CODE_OK;
import static org.apache.ignite.internal.processors.cache.persistence.snapshot.AbstractSnapshotSelfTest.snp;
import static org.apache.ignite.testframework.GridTestUtils.waitForCondition;
import static org.junit.Assume.assumeTrue;

/** Test for the command '--snapshot delete'. */
public class GridCommandHandlerDeleteSnapshotTest extends GridCommandHandlerAbstractTest {
Comment thread
zstan marked this conversation as resolved.
/** Flag to add an extra server node after the cluster start and the snapshot creation. */
@Parameter(1)
public boolean extraServerNode;

/** */
@Parameter(2)
public boolean incremental;

/** */
@Parameter(3)
public boolean changeBaseline;

/** */
@Parameter(4)
public boolean customPath;

/** */
@Parameter(5)
public boolean separatedWorkDir;

/** */
@Parameters(name = "client={0},useExtraNode={1},inc={2},chBaseln={3},cstSnpPath={4},ownWorkDir={5}")
public static Collection<?> parameters() {
return GridTestUtils.cartesianProduct(
commandHandlers(),
F.asList(false, true), // Use or not extra server node after the cluster start and the snapshot creation;
F.asList(false, true), // Add incremental snapshot;
F.asList(false, true), // Change baseline;
F.asList(false, true), // Use custom snapshot path;
F.asList(false, true) // Separated (own) work directory.
);
}

/** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
super.afterTest();

stopAllGrids();

cleanPersistenceDir();
}

/** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
super.beforeTest();

/** Handy if test running is interrupted and {@link #afterTest()} isn't invoked. */
Comment thread
Vladsz83 marked this conversation as resolved.
cleanPersistenceDir();
}

/** {@inheritDoc} */
@Override protected void cleanPersistenceDir() throws Exception {
super.cleanPersistenceDir();

// Also cleans separated snapshot working directories and custom snapshot paths.
try (DirectoryStream<Path> files = newDirectoryStream(Paths.get(U.defaultWorkDirectory()))) {
for (Path path : files)
U.delete(path);
}
}

/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

if (separatedWorkDir)
cfg.setWorkDirectory(new File(U.defaultWorkDirectory(), igniteInstanceName).getAbsolutePath());

return cfg;
}

/** */
@Test
public void testSnapshotDelete() throws Exception {
Comment thread
Vladsz83 marked this conversation as resolved.
// A custom snapshot path actually puts snapshots in a shared directory. This skews the results when dedicated
// work directories are set.
assumeTrue(!customPath || !separatedWorkDir);

int entriesCnt = 100;
int initNodes = 3;

walCompactionEnabled(incremental);

IgniteEx ig = (IgniteEx)startGridsMultiThreaded(initNodes);

if (changeBaseline) {
ig.cluster().baselineAutoAdjustEnabled(false);

ig.cluster().setBaselineTopology(ig.cluster().topologyVersion());
}

ig.cluster().state(ACTIVE);

createCacheAndPreload(ig, entriesCnt);

File cstSnpsRoot = customPath
? new File(grid(0).context().pdsFolderResolver().fileTree().snapshotsRoot(), "ex_snapshots")
: null;
File snpDir = new File(customPath ? cstSnpsRoot : ig.context().pdsFolderResolver().fileTree().snapshotsRoot(), "testSnapshot");

snp(ig).createSnapshot("testSnapshot", customPath ? cstSnpsRoot.getAbsolutePath() : null, false, false)
.get(getTestTimeout());

if (incremental) {
for (int i = 0; i < 3; ++i) {
int dataIdx = entriesCnt + entriesCnt / 4 * i;

try (IgniteDataStreamer<Object, Object> streamer = ig.dataStreamer(DEFAULT_CACHE_NAME)) {
for (int d = dataIdx; d < dataIdx + entriesCnt / 4; ++d)
streamer.addData(d, d);
}

snp(ig).createSnapshot("testSnapshot", customPath ? cstSnpsRoot.getAbsolutePath() : null, true, false)
.get(getTestTimeout());
}
}

String baselineGone = null;

// Optionally restarts with the same servers number, but changed baseline. The snapshot is kept on the same
// previous nodes independently of the baseline.
if (changeBaseline) {
baselineGone = grid(initNodes - 1).name();

ig.destroyCache(DEFAULT_CACHE_NAME);
awaitPartitionMapExchange();

stopAllGrids();

ig = (IgniteEx)startGridsMultiThreaded(initNodes - 1);

ig.cluster().setBaselineTopology(ig.cluster().topologyVersion());

startGrid(initNodes - 1);

assertEquals(initNodes - 1, ig.cluster().currentBaselineTopology().size());
assertEquals(initNodes, ig.cluster().nodes().size());
}

// Optionally adds extra server.
if (extraServerNode)
startGrid(initNodes);

injectTestSystemOut();

// Tests missing snapshot deletion.
if (customPath) {
assertEquals(EXIT_CODE_OK, execute(newCommandHandler(createTestLogger()), "--snapshot", "delete", "--src",
cstSnpsRoot.getAbsolutePath(), "wrongSnapshot"));

assertEquals(EXIT_CODE_OK, execute(newCommandHandler(createTestLogger()), "--snapshot", "delete", "--src",
cstSnpsRoot.getAbsolutePath() + "_wrongPath", "testSnapshot"));
}
else
assertEquals(EXIT_CODE_OK, execute(newCommandHandler(createTestLogger()), "--snapshot", "delete", "wrongSnapshot"));

String out = testOut.toString();

assertFalse(out.contains(SnapshotDeleteCommand.REMOVED_PREF));
assertFalse(out.contains(SnapshotDeleteCommand.NODE_NOT_FOUND_PREF));
assertTrue(out.contains(SnapshotDeleteCommand.NOT_FOUND));

testOut.reset();
assertTrue(testOut.toString().isEmpty());

if (customPath) {
assertEquals(EXIT_CODE_OK, execute(newCommandHandler(createTestLogger()), "--snapshot", "delete", "--src",
cstSnpsRoot.getAbsolutePath(), "testSnapshot"));
}
else
assertEquals(EXIT_CODE_OK, execute(newCommandHandler(createTestLogger()), "--snapshot", "delete", "testSnapshot"));

out = testOut.toString();

if (changeBaseline)
assertTrue(out.contains(SnapshotDeleteCommand.MISSING_BASELINES + baselineGone));

if (separatedWorkDir) {
// When the nodes use own separated work directory, we expect a strict result.
assertTrue(out.contains(SnapshotDeleteCommand.REMOVED_PREF));

if (extraServerNode)
assertTrue(out.contains(SnapshotDeleteCommand.NODE_NOT_FOUND_PREF));
}
else {
// When nodes use a shared work directory, there is a race for the delete operation. One node can get faster
// than others and remove snapshot completely quickly. The others might not find snapshot files. We can be
// only sure that at least one node removes snapshot.
assertTrue(out.contains(SnapshotDeleteCommand.REMOVED_PREF) || out.contains(SnapshotDeleteCommand.UNSURE_DELETION_PREF));
}

assertFalse(out.contains("Snapshot not found on current server nodes"));

assertTrue(waitForCondition(() -> !snpDir.exists(), getTestTimeout()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@
import org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotCheckPartitionHashesResponse;
import org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotCheckProcessRequest;
import org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotCheckResponse;
import org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotDeleteRequest;
import org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotDeleteResponse;
import org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotFilesFailureMessage;
import org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotFilesRequestMessage;
import org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotHandlerResult;
Expand Down Expand Up @@ -436,6 +438,8 @@ public CoreMessagesProvider() {
register(SnapshotFilesFailureMessage.class);
register(IncrementalSnapshotVerifyResult.class);
register(IncrementalSnapshotAwareMessage.class);
register(SnapshotDeleteRequest.class);
register(SnapshotDeleteResponse.class);

// [6300 - 6400]: Services messages. Most of them originally come from Discovery.
msgIdx = 6300;
Expand Down
Loading
Loading