GitHub user mfenes opened a pull request:

    https://github.com/apache/zookeeper/pull/450

    ZOOKEEPER-2967: Add check to validate dataDir and dataLogDir paramete…

    ZOOKEEPER-2967: Add check to validate dataDir and dataLogDir parameters at 
startup
    
    This PR adds a check to protect ZK against configuring dataDir and 
dataLogDir opposingly.
    
    When FileTxnSnapLog is created, it checks if transaction log directory 
contains snapshot files or vice versa, snapshot directory contains transaction 
log files. If so, the check throws LogdirContentCheckException or 
SnapdirContentCheckException, respectively, which translates to 
DatadirException at ZK startup in QuorumPeerMain and ZooKeeperServerMain.
    
    If the two directories are the same, then no check is done.
    
    For testing, I've added 4 new unit tests which cover the following cases:
    
    1. transaction log and snapshot directories are different and they are used 
correctly (no Exception)
    2. transaction log and snapshot directories are the same (in this case no 
check is done)
    3. transaction log and snapshot directories are different and transaction 
log directory contains snapshot files (LogdirContentCheckException -> ZK quits)
    4. transaction log and snapshot directories are different and snapshot 
directory contains transaction log files (SnapdirContentCheckException -> ZK 
quits)


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/mfenes/zookeeper ZOOKEEPER-2967

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/zookeeper/pull/450.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #450
    
----
commit 81c026fe8498107f42e9d3599a515c8817f8bf02
Author: Mark Fenes <mfenes@...>
Date:   2018-01-19T23:16:07Z

    ZOOKEEPER-2967: Add check to validate dataDir and dataLogDir parameters at 
startup

----


---

Reply via email to