You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Cameron Zemek (Jira)" <ji...@apache.org> on 2022/10/10 00:42:00 UTC

[jira] [Updated] (CASSANDRA-17955) Race condition on repair snapshots

     [ https://issues.apache.org/jira/browse/CASSANDRA-17955?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Cameron Zemek updated CASSANDRA-17955:
--------------------------------------
    Description: 
If an endpoint is convicted and that endpoint is a coordinator then ActiveRepairService::removeParentRepairSession is called.

The issue is that this occurs on clearSnapshotExecutor and can happen while RepairMessageVerbHandler is in process of taking a snapshot. So then you get a race condition and clearSnapshot will throw a java.nio.file.DirectoryNotEmptyException

 
{code:java}
public static void deleteRecursiveWithThrottle(File dir, RateLimiter rateLimiter)
{
    if (dir.isDirectory())
    {
        String[] children = dir.list();
        for (String child : children)
            deleteRecursiveWithThrottle(new File(dir, child), rateLimiter);
    }

    // The directory is now empty so now it can be smoked
    deleteWithConfirmWithThrottle(dir, rateLimiter);
} {code}
Due to the directory not being empty when it goes to remove the directory at the end.

  was:
If an endpoint is convicted and that endpoint is a coordinator then ActiveRepairService::

removeParentRepairSession is called.

The issue is that this occurs on clearSnapshotExecutor and can happen while 

RepairMessageVerbHandler is in process of taking a snapshot. So then you get a race condition and clearSnapshot will throw a java.nio.file.DirectoryNotEmptyException

 
{code:java}
public static void deleteRecursiveWithThrottle(File dir, RateLimiter rateLimiter)
{
    if (dir.isDirectory())
    {
        String[] children = dir.list();
        for (String child : children)
            deleteRecursiveWithThrottle(new File(dir, child), rateLimiter);
    }

    // The directory is now empty so now it can be smoked
    deleteWithConfirmWithThrottle(dir, rateLimiter);
} {code}
Due to the directory not being empty when it goes to remove the directory at the end.


> Race condition on repair snapshots
> ----------------------------------
>
>                 Key: CASSANDRA-17955
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-17955
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Cameron Zemek
>            Priority: Normal
>              Labels: 4.0
>
> If an endpoint is convicted and that endpoint is a coordinator then ActiveRepairService::removeParentRepairSession is called.
> The issue is that this occurs on clearSnapshotExecutor and can happen while RepairMessageVerbHandler is in process of taking a snapshot. So then you get a race condition and clearSnapshot will throw a java.nio.file.DirectoryNotEmptyException
>  
> {code:java}
> public static void deleteRecursiveWithThrottle(File dir, RateLimiter rateLimiter)
> {
>     if (dir.isDirectory())
>     {
>         String[] children = dir.list();
>         for (String child : children)
>             deleteRecursiveWithThrottle(new File(dir, child), rateLimiter);
>     }
>     // The directory is now empty so now it can be smoked
>     deleteWithConfirmWithThrottle(dir, rateLimiter);
> } {code}
> Due to the directory not being empty when it goes to remove the directory at the end.



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

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