From f57c3842a284b314da172d5968c66923b74619b6 Mon Sep 17 00:00:00 2001 From: "Robert (Bobby) Evans" Date: Mon, 30 Jan 2017 09:58:46 -0600 Subject: [PATCH] ZOOKEEPER-2678: Fixed another race --- .../test/org/apache/zookeeper/server/quorum/Zab1_0Test.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/java/test/org/apache/zookeeper/server/quorum/Zab1_0Test.java b/src/java/test/org/apache/zookeeper/server/quorum/Zab1_0Test.java index cc0c3064cfa..a7695b0a59a 100644 --- a/src/java/test/org/apache/zookeeper/server/quorum/Zab1_0Test.java +++ b/src/java/test/org/apache/zookeeper/server/quorum/Zab1_0Test.java @@ -850,8 +850,14 @@ public void converseWithFollower(InputArchive ia, OutputArchive oa, // Make sure the data was recorded in the filesystem ok ZKDatabase zkDb2 = new ZKDatabase(new FileTxnSnapLog(logDir, snapDir)); + start = System.currentTimeMillis(); zkDb2.loadDataBase(); + while (zkDb2.getSessionWithTimeOuts().isEmpty() && (System.currentTimeMillis() - start) < 50) { + Thread.sleep(1); + zkDb2.loadDataBase(); + } LOG.info("zkdb2 sessions:" + zkDb2.getSessions()); + LOG.info("zkdb2 with timeouts:" + zkDb2.getSessionWithTimeOuts()); Assert.assertNotNull(zkDb2.getSessionWithTimeOuts().get(4L)); } finally { recursiveDelete(tmpDir);