Skip to content

IGNITE-29050 Introduce snapshot deletion command - #13577

Open
Vladsz83 wants to merge 126 commits into
apache:masterfrom
Vladsz83:Introduce-snapshot-deletion-command
Open

Vladsz83 wants to merge 126 commits into
apache:masterfrom
Vladsz83:Introduce-snapshot-deletion-command

Conversation

@Vladsz83

Copy link
Copy Markdown
Contributor

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)
  • The pull request has been checked by the Teamcity Bot and
    the green visa attached to the JIRA ticket (see tab PR Check at TC.Bot - Instance 1 or TC.Bot - Instance 2)

Notes

If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com #ignite channel.

Comment on lines +378 to +379
if (status == null || status == res.status)
status = res.status;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do u need to set status = res.status if it already can be the same ? status == res.status branch

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Will push a bit later

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now it hard to understand logic : if status ==null - you set it to res.status, otherwize you set it to PARTLY despite of incoming status (

Copilot AI left a comment

Copy link
Copy Markdown

U.delete(sft.binaryMeta());
sft.allStorages().forEach(U::delete);
U.delete(sft.meta());
if (!sft.meta().delete() && sft.meta().exists())

// We need to find and read snapshot metas to ensure the content is a snapshot. Also, the metas contain
// initial cluster topology and actual snapshot folder names.
List<SnapshotMetadata> locMetas = kctx.cache().context().snapshotMgr().readSnapshotMetadatas(snpFiles, false);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems not so critical. On separated nodes, with own working directory, there is one snapshot. In the shared snapshot folder, we'll try to remove entire if just one meta is read. It is ok to me.

public static final IgniteFeature ROLLING_UPGRADE_FEATURE = new IgniteCoreFeature(0);

/** */
public static final IgniteFeature SNAPSHOT_DELETE_FEATURE = new IgniteCoreFeature(1);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is relative test sets. I think isn't critical it all the related tests passes.

Comment on lines +39 to +40
@Argument(example = "path/to/snapshots", optional = true, description = "Path to snapshot location directory. If not specified " +
"or specified a relative path, the default snapshot configuration directory will be used")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes

if (snpName == null)
return false;

return snpName.equalsIgnoreCase(restoreCacheGrpProc.restoringSnapshotName());

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We know. Many snapshot operations doesn't support case insensitivity. This is current limitation. We have tests for such cases. Bringing filesystem-aware/path-aware comparison everywhere is out of scope of this ticket.


if (rec.type() == CLUSTER_SNAPSHOT && ((ClusterSnapshotRecord)rec).clusterSnapshotName().equals(sft.name())) {
// A filesystem might not support the character case of directory or file name.
if (rec.type() == CLUSTER_SNAPSHOT && ((ClusterSnapshotRecord)rec).clusterSnapshotName().equalsIgnoreCase(sft.name())) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We know. Many snapshot operations doesn't support case insensitivity. This is current limitation. We have tests for such cases. Bringing filesystem-aware/path-aware comparison everywhere is out of scope of this ticket.

return new GridFinishedFuture<>(new NodeStoppingException("The node is stopping: " + kctx.localNodeId()));

ctx = contexts.computeIfAbsent(req.snapshotName(), snpName -> new SnapshotCheckContext(req));
ctx = contexts.computeIfAbsent(req.snapshotName().toLowerCase(Locale.ROOT), snpName -> new SnapshotCheckContext(req));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We know. Many snapshot operations doesn't support case insensitivity. This is current limitation. We have tests for such cases. Bringing filesystem-aware/path-aware comparison everywhere is out of scope of this ticket.


SnapshotOperationRequest curCreateRq = snpMgr.currentCreateRequest();

if (curCreateRq != null && curCreateRq.snpName.equalsIgnoreCase(req.snpName)) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We know. Many snapshot operations doesn't support case insensitivity. This is current limitation. We have tests for such cases. Bringing filesystem-aware/path-aware comparison everywhere is out of scope of this ticket.

Comment on lines +237 to +238
if (pathRef.get() != null && pathRef.get() != null)
Files.setPosixFilePermissions(pathRef.get(), prevPerms.get());

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

… into IGNITE-29050-Introduce-snapshot-deletion-command

# Conflicts:
#	modules/core/src/test/resources/org.apache.ignite.util/GridCommandHandlerClusterByClassWithSSLTest_help.output
…ommand

# Conflicts:
#	modules/core/src/test/java/org/apache/ignite/internal/processors/rollingupgrade/feature/TestIgniteReleaseFeatures_2_19_1.java
… into IGNITE-29050-Introduce-snapshot-deletion-command

# Conflicts:
#	modules/core/src/test/java/org/apache/ignite/internal/processors/rollingupgrade/feature/TestIgniteReleaseFeatures_2_19_1.java
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown

Possible compatibility issues. Please, check rolling upgrade cases

This PR modifies protected classes (with Order annotation).
Changes to these classes can break rolling upgrade compatibility.

Affected files:

  • modules/core/src/main/java/org/apache/ignite/internal/management/snapshot/SnapshotDeleteCommandArg.java
  • modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotDeleteProcessResult.java
  • modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotDeleteRequest.java
  • modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotDeleteResponse.java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants