You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by afine <gi...@git.apache.org> on 2017/12/19 02:33:50 UTC

[GitHub] zookeeper pull request #436: [WIP] ZOOKEEPER-2249: CRC check failed when pre...

GitHub user afine opened a pull request:

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

    [WIP] ZOOKEEPER-2249: CRC check failed when preAllocSize smaller than node data

    

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

    $ git pull https://github.com/afine/zookeeper ZOOKEEPER-2249

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

    https://github.com/apache/zookeeper/pull/436.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 #436
    
----
commit 99236e2ddb10de6d20e5afea7e79751404ae48c6
Author: Abraham Fine <af...@apache.org>
Date:   2017-12-19T02:33:11Z

    ZOOKEEPER-2249: CRC check failed when preAllocSize smaller than node data

----


---

[GitHub] zookeeper pull request #436: ZOOKEEPER-2249: CRC check failed when preAllocS...

Posted by afine <gi...@git.apache.org>.
Github user afine commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/436#discussion_r158392075
  
    --- Diff: src/java/main/org/apache/zookeeper/server/persistence/Util.java ---
    @@ -211,7 +211,7 @@ public static long padLogFile(FileOutputStream f,long currentSize,
                 long preAllocSize) throws IOException{
             long position = f.getChannel().position();
             if (position + 4096 >= currentSize) {
    -            currentSize = currentSize + preAllocSize;
    +            currentSize = position + preAllocSize;
    --- End diff --
    
    Fixed


---

[GitHub] zookeeper pull request #436: ZOOKEEPER-2249: CRC check failed when preAllocS...

Posted by phunt <gi...@git.apache.org>.
Github user phunt commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/436#discussion_r157918305
  
    --- Diff: src/java/main/org/apache/zookeeper/server/persistence/Util.java ---
    @@ -211,7 +211,7 @@ public static long padLogFile(FileOutputStream f,long currentSize,
                 long preAllocSize) throws IOException{
             long position = f.getChannel().position();
             if (position + 4096 >= currentSize) {
    -            currentSize = currentSize + preAllocSize;
    +            currentSize = position + preAllocSize;
    --- End diff --
    
    Nice catch Abe! This looks like a reasonable fix, however it results in the doc'd invariant not being followed
    
    "allocates space in the transaction log file in blocks of preAllocSize kilobytes"
    
    I believe in this case you want something which will maintain the file as a multiple of this value.
    
    Perhaps a while loop inside the conditional, replacing "currentSize = currentSize + preAllocSize;" with:
    
    while (position + 4096 >= currentSize) {
      currentSize = currentSize + preAllocSize
    }


---

[GitHub] zookeeper issue #436: ZOOKEEPER-2249: CRC check failed when preAllocSize sma...

Posted by phunt <gi...@git.apache.org>.
Github user phunt commented on the issue:

    https://github.com/apache/zookeeper/pull/436
  
    LGTM +1. Thanks @afine . Committed to 3.4/3.5/trunk.


---

[GitHub] zookeeper pull request #436: ZOOKEEPER-2249: CRC check failed when preAllocS...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

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


---