TisonKun edited a comment on issue #8046: [FLINK-12006][coordination] Ensure 
owned znode deleted on ZooKeeperHaServices#deleteOwnedZNode
URL: https://github.com/apache/flink/pull/8046#issuecomment-477234305
 
 
   @tillrohrmann Thanks for your analysis. It looks reasonable. For this test 
we can extract the TestingListener and ensure that the leader is elected. Thus 
operation 2 happens before operation 1.
   
   ```
    import org.apache.flink.runtime.util.ZooKeeperUtils;
    import org.apache.flink.runtime.zookeeper.ZooKeeperResource;
   @@ -191,11 +192,15 @@ public class ZooKeeperHaServicesTest extends 
TestLogger {
                           final LeaderElectionService 
resourceManagerLeaderElectionService = 
zooKeeperHaServices.getResourceManagerLeaderElectionService();
                           final RunningJobsRegistry runningJobsRegistry = 
zooKeeperHaServices.getRunningJobsRegistry();
    
   -                       resourceManagerLeaderRetriever.start(new 
TestingListener());
   +                       final TestingListener listener = new 
TestingListener();
   +
   +                       resourceManagerLeaderRetriever.start(listener);
                           resourceManagerLeaderElectionService.start(new 
TestingContender("foobar", resourceManagerLeaderElectionService));
                           final JobID jobId = new JobID();
                           runningJobsRegistry.setJobRunning(jobId);
    
   +                       listener.waitForNewLeader(2000L);
   +
                           resourceManagerLeaderRetriever.stop();
                           resourceManagerLeaderElectionService.stop();
                           runningJobsRegistry.clearJob(jobId);
   ```
   
   However, in production code it is still buggy on this execute order. But if 
we bump ZK version to support CreateMode#CONTAINER, then the remain znode(path) 
should be all containers and thus we can say that they will finally get removed.
   
   For reproduce the problem, we might force same order with hook of 
background. But I have no idea how to ensure the background 
`creatingParentContainersIfNeeded` perform after delete children.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to