Github user enixon commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/120#discussion_r95862018
  
    --- Diff: 
src/java/main/org/apache/zookeeper/server/persistence/FileTxnSnapLog.java ---
    @@ -175,11 +193,20 @@ public long restore(DataTree dt, Map<Long, Integer> 
sessions,
                             "No snapshot found, but there are log entries. " +
                             "Something is broken!");
                 }
    -            /* TODO: (br33d) we should either put a ConcurrentHashMap on 
restore()
    -             *       or use Map on save() */
    -            save(dt, (ConcurrentHashMap<Long, Integer>)sessions);
    -            /* return a zxid of zero, since we the database is empty */
    -            return 0;
    +
    +            if (suspectEmptyDB) {
    +                /* return a zxid of -1, since we are possibly missing data 
*/
    +                LOG.warn("Unexpected empty data tree, setting zxid to -1");
    --- End diff --
    
    We only reach this point if our `SnapShot` interface was not able to 
deserialize anything into the `DataTree`. In the usual case of `FileSnap`, this 
happens only when there aren't any non-corrupted snapshots to be loaded.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to