You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by an...@apache.org on 2020/01/24 14:18:32 UTC
[zookeeper] branch branch-3.5 updated: ZOOKEEPER-1936: Server exits
when unable to create data directory due to race
This is an automated email from the ASF dual-hosted git repository.
andor pushed a commit to branch branch-3.5
in repository https://gitbox.apache.org/repos/asf/zookeeper.git
The following commit(s) were added to refs/heads/branch-3.5 by this push:
new d461171 ZOOKEEPER-1936: Server exits when unable to create data directory due to race
d461171 is described below
commit d461171d95e13184055c08f66fad4094ae5c5e36
Author: Andor Molnar <an...@apache.org>
AuthorDate: Thu Jan 23 16:46:28 2020 +0100
ZOOKEEPER-1936: Server exits when unable to create data directory due to race
Resurrecting an ancient ticket which could be fixed with a simple patch.
Jira mentions a scenario when auto purging tool is in use and Zookeeper server could have a race condition when creating snapshot and data directories. (directory auto creating is enabled by default)
Double checking the directory existence might help with it.
Author: Andor Molnar <an...@apache.org>
Reviewers: Enrico Olivelli <eo...@apache.org>
Closes #1225 from anmolnar/ZOOKEEPER-1936
(cherry picked from commit 689c8b2c4ed264f1dd75db7cbde1f86fe4408f50)
Signed-off-by: Andor Molnar <an...@apache.org>
---
.../java/org/apache/zookeeper/server/persistence/FileTxnSnapLog.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/server/persistence/FileTxnSnapLog.java b/zookeeper-server/src/main/java/org/apache/zookeeper/server/persistence/FileTxnSnapLog.java
index 3939231..47f025d 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/server/persistence/FileTxnSnapLog.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/server/persistence/FileTxnSnapLog.java
@@ -123,7 +123,7 @@ public class FileTxnSnapLog {
+ " is false). Please create this directory manually.");
}
- if (!this.dataDir.mkdirs()) {
+ if (!this.dataDir.mkdirs() && !this.dataDir.exists()) {
throw new DatadirException("Unable to create data directory "
+ this.dataDir);
}
@@ -143,7 +143,7 @@ public class FileTxnSnapLog {
+ " is false). Please create this directory manually.");
}
- if (!this.snapDir.mkdirs()) {
+ if (!this.snapDir.mkdirs() && !this.snapDir.exists()) {
throw new DatadirException("Unable to create snap directory "
+ this.snapDir);
}