You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by uce <gi...@git.apache.org> on 2016/02/04 16:20:35 UTC

[GitHub] flink pull request:

Github user uce commented on the pull request:

    https://github.com/apache/flink/commit/f8f747f2290ad623bd8a4f0d8ff4708fada6792a#commitcomment-15888699
  
    Thanks for looking into it.
    
    `ZKPaths.deleteChildren` actually looks like it already handles this. The `KeeperException.NoNodeException` can only happen if the initial path does not exist. Therefore I think that we can skip the retry loop.
    
    ```java
    public static void deleteChildren(ZooKeeper zookeeper, String path, boolean deleteSelf) throws InterruptedException, KeeperException
    {
        PathUtils.validatePath(path);
    
        List<String> children = zookeeper.getChildren(path, null);
        for ( String child : children )
        {
            String fullPath = makePath(path, child);
            deleteChildren(zookeeper, fullPath, true);
        }
    
        if ( deleteSelf )
        {
            try
            {
                zookeeper.delete(path, -1);
            }
            catch ( KeeperException.NotEmptyException e )
            {
                //someone has created a new child since we checked ... delete again.
                deleteChildren(zookeeper, path, true);
            }
            catch ( KeeperException.NoNodeException e )
            {
                // ignore... someone else has deleted the node it since we checked
            }
        }
    }
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---