[ 
https://issues.apache.org/jira/browse/CASSANDRA-17477?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17635994#comment-17635994
 ] 

n.v.harikrishna commented on CASSANDRA-17477:
---------------------------------------------

Sorry for taking so long to given an update. 

As per the code here 
[https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/service/ActiveRepairService.java#L585]
 
{noformat}
/**
 * we only want to set repairedAt for incremental repairs including all 
replicas for a token range. For non-global
 * incremental repairs, forced incremental repairs, and full repairs, the 
UNREPAIRED_SSTABLE value will prevent
 * sstables from being promoted to repaired or preserve the 
repairedAt/pendingRepair values, respectively.
 */
static long getRepairedAt(RepairOption options, boolean force)
{
    // we only want to set repairedAt for incremental repairs including all 
replicas for a token range. For non-global incremental repairs, full repairs, 
the UNREPAIRED_SSTABLE value will prevent
    // sstables from being promoted to repaired or preserve the 
repairedAt/pendingRepair values, respectively. For forced repairs, repairedAt 
time is only set to UNREPAIRED_SSTABLE if we actually
    // end up skipping replicas
    if (options.isIncremental() && options.isGlobal() && !force)
    {
        return currentTimeMillis();
    }
    else
    {
        return ActiveRepairService.UNREPAIRED_SSTABLE;
    }
}{noformat}
 

and RepairOption.isGlobal()
{noformat}
public boolean isGlobal()
{
    return dataCenters.isEmpty() && hosts.isEmpty();
}
{noformat}

it is behaving as expected as the data centre is explicitly specified in the 
first case.

 

 

> -dc option for repair, prevents incremental repairs
> ---------------------------------------------------
>
>                 Key: CASSANDRA-17477
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-17477
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Consistency/Repair
>            Reporter: Pedro Gordo
>            Assignee: n.v.harikrishna
>            Priority: Normal
>             Fix For: 4.0.x, 4.x
>
>
> By default running `{*}nodetool repair{*}` should trigger incremental 
> repairs, but this does not happen if you use the `{*}-dc{*}` flag, even 
> though the repair summary says `{*}incremental: true{*}`.
> You can replicate the issue with the following commands:
> {code:bash}
> ccm create test-incremental-repairs -v 4.0.1 -n 3 -s
> ccm node1 cqlsh -e "CREATE KEYSPACE keyspace1 WITH replication = {'class': 
> 'NetworkTopologyStrategy', 'datacenter1': 2 };"
> ccm stress write
> ccm node1 nodetool "repair keyspace1 standard1 -dc datacenter1"
> find ~/.ccm/test-incremental-repairs/*/data0/keyspace1/standard1* -name 
> *Data.db -exec <PATH_TO_TOOLS>/bin/sstablemetadata {} \; | grep Repaired
> ccm node1 nodetool "repair keyspace1 standard1"
> find ~/.ccm/test-incremental-repairs/*/data0/keyspace1/standard1* -name 
> *Data.db -exec <PATH_TO_TOOLS>/bin/sstablemetadata {} \; | grep Repaired
> {code}
> You'll notice that the output for the first `{*}find{*}` command will all be 
> `{*}Repaired at: 0{*}`, but the second `{*}find{*}` command will give you 
> results like `{*}Repaired at: 1648044754464 (03/23/2022 14:12:34){*}`. 
> At the same time, both `{*}nodetool repair{*}` commands will output like the 
> following:
> {code:bash}
> [2022-03-23 15:15:52,500] Starting repair command #2 
> (20f12190-aabc-11ec-a3d4-e9e5a941ef6c), repairing keyspace keyspace1 with 
> repair options (parallelism: parallel, primary range: false, incremental: 
> true, job threads: 1, ColumnFamilies: [standard1], dataCenters: 
> [datacenter1], hosts: [], previewKind: NONE, # of ranges: 2, pull repair: 
> false, force repair: false, optimise streams: false, ignore unreplicated 
> keyspaces: false)
> {code}
> Indicating `{*}incremental: true{*}` for both of them.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to