[ https://issues.apache.org/jira/browse/ZOOKEEPER-2967?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16344235#comment-16344235 ]
ASF GitHub Bot commented on ZOOKEEPER-2967: ------------------------------------------- Github user mfenes commented on a diff in the pull request: https://github.com/apache/zookeeper/pull/450#discussion_r164605521 --- Diff: src/java/main/org/apache/zookeeper/server/persistence/FileTxnSnapLog.java --- @@ -136,13 +136,51 @@ public FileTxnSnapLog(File dataDir, File snapDir) throws IOException { throw new DatadirException("Cannot write to snap directory " + this.snapDir); } + // check content of transaction log and snapshot dirs if they are two different directories + if(!this.dataDir.getPath().equals(this.snapDir.getPath())){ + checkLogDir(); + checkSnapDir(); + } + txnLog = new FileTxnLog(this.dataDir); snapLog = new FileSnap(this.snapDir); autoCreateDB = Boolean.parseBoolean(System.getProperty(ZOOKEEPER_DB_AUTOCREATE, ZOOKEEPER_DB_AUTOCREATE_DEFAULT)); } + private void checkLogDir() throws LogdirContentCheckException { + File[] files = this.dataDir.listFiles(); --- End diff -- Changed implementation to use FilenameFilter. > Add check to validate dataDir and dataLogDir parameters at startup > ------------------------------------------------------------------ > > Key: ZOOKEEPER-2967 > URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2967 > Project: ZooKeeper > Issue Type: Improvement > Components: server > Affects Versions: 3.4.11 > Reporter: Andor Molnar > Assignee: Mark Fenes > Priority: Major > Labels: startup, validation > Fix For: 3.5.4, 3.6.0, 3.4.12 > > > According to -ZOOKEEPER-2960- we should at a startup check to validate that > dataDir and dataLogDir parameters are set correctly. > Perhaps we should introduce a check of some kind? If datalogdir is different > that datadir and snapshots exist in datalogdir we throw an exception and quit. -- This message was sent by Atlassian JIRA (v7.6.3#76005)