[
https://issues.apache.org/jira/browse/FLINK-12006?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16802970#comment-16802970
]
TisonKun commented on FLINK-12006:
----------------------------------
[~till.rohrmann] your analysis is reasonable. For this test we can extract the
{{TestingListener}} and ensure that the leader is elected. Thus operation 2
happens before operation 1.
{code:java}
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);
{code}
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.
> ZooKeeperHaServicesTest.testSimpleCloseAndCleanupAllData is unstable
> --------------------------------------------------------------------
>
> Key: FLINK-12006
> URL: https://issues.apache.org/jira/browse/FLINK-12006
> Project: Flink
> Issue Type: Bug
> Components: Runtime / Coordination
> Reporter: Aljoscha Krettek
> Assignee: TisonKun
> Priority: Critical
> Labels: pull-request-available, test-stability
> Time Spent: 10m
> Remaining Estimate: 0h
>
> This is the log from a failed Travis run:
> https://travis-ci.org/apache/flink/jobs/510263371
> The relevant section is:
> {code}
> 11:15:11.201 [INFO] Running
> org.apache.flink.runtime.highavailability.zookeeper.ZooKeeperHaServicesTest
> 11:15:12.908 [INFO] Tests run: 23, Failures: 0, Errors: 0, Skipped: 0, Time
> elapsed: 9.255 s - in org.apache.flink.runtime.jobmaster.JobMasterTest
> 11:15:13.646 [INFO] Running
> org.apache.flink.runtime.highavailability.zookeeper.ZooKeeperRegistryTest
> 11:15:14.874 [ERROR] Tests run: 3, Failures: 1, Errors: 0, Skipped: 0, Time
> elapsed: 3.67 s <<< FAILURE! - in
> org.apache.flink.runtime.highavailability.zookeeper.ZooKeeperHaServicesTest
> 11:15:14.874 [ERROR]
> testSimpleCloseAndCleanupAllData(org.apache.flink.runtime.highavailability.zookeeper.ZooKeeperHaServicesTest)
> Time elapsed: 0.132 s <<< FAILURE!
> java.lang.AssertionError:
> Expected: is <[zookeeper]>
> but: was <[zookeeper, foo]>
> at
> org.apache.flink.runtime.highavailability.zookeeper.ZooKeeperHaServicesTest.testSimpleCloseAndCleanupAllData(ZooKeeperHaServicesTest.java:136)
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)