The rebuild operation doesn't have any relation to repairs.
nodetool rebuild
will populate data for token ranges on a node depending on whether the data has been streamed before or not (through bootstrap or rebuild).
Cassandra stores the "state" of token ranges of a node in the system.available_ranges
table. If a node has been bootstrapped or rebuilt successfully, it will store the available ranges for each keyspace so it knows which data it can serve for read requests.
Furthermore, this error:
Unable to find sufficient sources for streaming range
would have been due to you removing the source DC from replication so Cassandra could not rebuild the new DC because there are no longer any replicas in the source DC you specified.
When you removed the source DC from the rebuild
command, it just streamed the data from the other nodes in the new DC which is bad because the DC does not have data, by definition it is new.
In any case, your "experiment" is invalid. Repair is not a recommended way to transfer data to a new node. If it was, we wouldn't have a need for rebuild
.
Think of your situation where you have 2 DCs with 3 replicas in each DC. This means a total of 6 replicas (2 DCs x 3 replicas). Repair is very expensive because it compares the data between 6 replicas to determine which data is missing on the node where you ran it.
Since the node is new, we already know it doesn't have data so doing the comparison with the 5 other replicas in the cluster is a waste of resources. All that is required is to request the data from another replica which is exactly what rebuild
is designed to do. Cheers!
nodetool rebuild
command you're running, (3) output ofnodetool status
, (4) full error message, (5) full stack trace, and (6) Cassandra version. Cheers!