curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "hebelala (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CURATOR-430) deletingChildrenIfNeeded maybe cannot delete children completely when multi-client delete concurrently
Date Mon, 14 Aug 2017 07:35:00 GMT

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

hebelala commented on CURATOR-430:
----------------------------------

Yes, I have test. Please see the code, and debug it.
The debug breakpoints are *step1*, *step2*, and *ZkPaths.deleteChildren -> List<String>
children = zookeeper.getChildren(path, null);*


{code:java}
public static void main(String[] args) {
        try {

            TestingServer server = new TestingServer();
            server.start();

            final CuratorFramework curatorFramework = CuratorFrameworkFactory.builder().connectString(server.getConnectString()).sessionTimeoutMs(600
* 1000).retryPolicy(new RetryNTimes(3, 1000)).build();
            curatorFramework.start();
            curatorFramework.blockUntilConnected();

            curatorFramework.create().creatingParentsIfNeeded().forPath("/a/1");
            curatorFramework.create().creatingParentsIfNeeded().forPath("/a/2");

            // try to delete /a
            new Thread(new Runnable() {
                public void run() {
                    try {
                        // step1
                        // deleting sequence is: /a/2, /a/1, /a
                        curatorFramework.delete().deletingChildrenIfNeeded().forPath("/a");
                    } catch (Exception e) {
                        e.printStackTrace();
                        try {
                            // the /a/1 is existing, because step2 delete /a/2, causes step1
throw NoNodeException(/a/2).  It's not expected.
                            Stat stat = curatorFramework.checkExists().forPath("/a/1");
                            System.out.println("checkExits:" + stat);
                        } catch (Exception e1) {
                            e1.printStackTrace();
                        }
                    }
                }
            }).start();

            Thread.sleep(1000L);
            // step2
            // delete /a/2, when step1 try to delete /a/2 and is going to zookeeper.getChildren("/a/2",
null)
            curatorFramework.delete().forPath("/a/2");

            System.out.println("ok");

            Thread.sleep(1000L);

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            System.exit(0);
        }

    }
{code}


> deletingChildrenIfNeeded maybe cannot delete children completely when multi-client delete
concurrently
> ------------------------------------------------------------------------------------------------------
>
>                 Key: CURATOR-430
>                 URL: https://issues.apache.org/jira/browse/CURATOR-430
>             Project: Apache Curator
>          Issue Type: Bug
>          Components: Client
>            Reporter: hebelala
>
> use curatorFramework.delete().deletingChildrenIfNeeded().forPath(path), this sync api
doesn't ignore the NoNodeException, causes the rest of children nodes will not be deleted
perhaps.
> zookeeper.getChildren(path, null) maybe throw NoNodeException, if the path doesn't exist.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message