Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CASSANDRA-20151 enable filtering of snapshots on keyspace, table and snapshot name #3752

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

smiklosovic
Copy link
Contributor

@smiklosovic smiklosovic commented Dec 18, 2024

No description provided.

@Option(title = "snapshot",
name = { "-n", "--snapshot"},
description = "Include snapshots of specified name")
private String snapshotName = null;
Copy link
Contributor Author

@smiklosovic smiklosovic Dec 18, 2024

Choose a reason for hiding this comment

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

A cautious reader sees that there is no logic related to filtering on the server side in this PR. This is because these changes are already there, we just do not exercise that functionality yet.

https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/service/snapshot/ListSnapshotsTask.java#L64-L76

Copy link
Contributor Author

@smiklosovic smiklosovic Dec 18, 2024

Choose a reason for hiding this comment

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

Also, -s for snapshot name flag would be more appropriate but we are saving that for sorting functionality which will come next, where -s is a no-brainer which will match -s flag in nodetool status.

* <pre>
* no_ttl: "true" or "false"
* include_ephemeral: "true" or "false"
* keyspace: name of keyspace to get snapshots of
Copy link
Contributor

Choose a reason for hiding this comment

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

From the server side logic, I see that keyspace, table and snapshot can be null. Should we document here what's the behavior on those cases?

{
return Arrays.stream(listSnapshotsStdOut.split("\n"))
.filter(line -> !line.isEmpty())
.filter(line -> !line.startsWith("Snapshot Details:") && !line.startsWith("There are no snapshots"))
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious: Is there any benefit from adding two filters with a && operator as opposed to four single filters on this stream?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants