Skip to content

Mbyrd/cassandra 21258/trunk#4876

Open
Jollyplum wants to merge 2 commits into
apache:trunkfrom
Jollyplum:mbyrd/CASSANDRA-21258/trunk
Open

Mbyrd/cassandra 21258/trunk#4876
Jollyplum wants to merge 2 commits into
apache:trunkfrom
Jollyplum:mbyrd/CASSANDRA-21258/trunk

Conversation

@Jollyplum

Copy link
Copy Markdown
Contributor

Currently rebuild supports rebuilding at the scope of keyspace but not individual table.
When an operator wants to load data (e.g a backup) for a specific table to only subset of nodes (e.g one D.C) and then rebuild the others from these nodes, this currently is not supported.
Allow passing through a set of tables to restrict to as part of rebuild when keyspace specified.

https://issues.apache.org/jira/browse/CASSANDRA-21258

will attach CI on ticket.

@@ -304,10 +306,11 @@ public RangeStreamer(ClusterMetadata metadata,
int connectionsPerHost,
MovementMap movements,
MovementMap strictMovements,
boolean excludeAccordTables)
boolean excludeAccordTables,
Set<String> tables)

@smiklosovic smiklosovic Jun 10, 2026

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.

maybe annotated this with @Nullable or make it so that it works with empty set or similar

@@ -772,11 +777,15 @@ public StreamResultFuture fetchAsync()
{
String[] cfNames = StreamPlan.nonAccordTablesForKeyspace(ksm);
if (cfNames != null)
{
cfNames = Arrays.stream(cfNames).filter(table -> tables == null || tables.contains(table)).toArray(String[]::new);

@smiklosovic smiklosovic Jun 10, 2026

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.

what if this.tables will be an empty set? Then cfNames will be empty array, no? Somebody might think that empty set is "all tables".

In "rebuild" you do

tables == null || tables.isEmpty() ? "(All tables)" : tables

so null and empty is indeed as "everything" which is not the case here ...

@@ -52,6 +55,11 @@ public class Rebuild extends AbstractCommand
description = "Use --exclude-local-dc to exclude nodes in local data center as source for streaming.")
private boolean excludeLocalDatacenterNodes = false;

@Option(paramLabel = "specific_tables",
names = {"-tb", "--table"},

@smiklosovic smiklosovic Jun 10, 2026

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.

I can do this? --table tb1 --table tb2? Or is it meant to be --table tb1 tb2?

@Option(paramLabel = "specific_tables",
names = {"-tb", "--table"},
description = "Use -tb to scope the rebuild to particular table")
private Set<String> tables = new HashSet<>();

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.

so on empty --tables, all code path will be executed with empty set instead of null, right?

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