Commit ac7765b9 authored by Thawan Kooburat's avatar Thawan Kooburat
Browse files

ZOOKEEPER-1798. Fix race condition in testNormalObserverRun (thawan, fpj via thawan)

git-svn-id: https://svn.apache.org/repos/asf/zookeeper/branches/branch-3.4@1535497 13f79535-47bb-0310-9956-ffa450edef68
parent 33c6d2d8
......@@ -152,6 +152,9 @@ BUGFIXES:
ZOOKEEPER-1744. clientPortAddress breaks "zkServer.sh status"
(Nick Ohanian via phunt)
ZOOKEEPER-1798. Fix race condition in testNormalObserverRun
(thawan, fpj via thawan)
IMPROVEMENTS:
ZOOKEEPER-1564. Allow JUnit test build with IBM Java
......
......@@ -212,8 +212,15 @@ public class SyncRequestProcessor extends Thread implements RequestProcessor {
if(running){
this.join();
}
if (!toFlush.isEmpty()) {
flush(toFlush);
}
} catch(InterruptedException e) {
LOG.warn("Interrupted while wating for " + this + " to finish");
} catch (IOException e) {
LOG.warn("Got IO exception during shutdown");
} catch (RequestProcessorException e) {
LOG.warn("Got request processor exception during shutdown");
}
if (nextProcessor != null) {
nextProcessor.shutdown();
......
......@@ -1113,6 +1113,10 @@ public class Zab1_0Test {
Assert.assertEquals("data2", new String(o.zk
.getZKDatabase().getData("/foo2", stat, null)));
// Shutdown sequence guarantee that all pending requests
// in sync request processor get flush to disk
o.zk.shutdown();
zkDb2 = new ZKDatabase(new FileTxnSnapLog(logDir, snapDir));
lastZxid = zkDb2.loadDataBase();
Assert.assertEquals("data2", new String(zkDb2.getData("/foo1", stat, null)));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment