zookeeper-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [zookeeper] hanm commented on a change in pull request #1069: ZOOKEEPER-3056: Fails to load database with missing snapshot file but with valid transaction log file.
Date Fri, 30 Aug 2019 21:25:14 GMT
hanm commented on a change in pull request #1069: ZOOKEEPER-3056: Fails to load database with
missing snapshot file but with valid transaction log file.
URL: https://github.com/apache/zookeeper/pull/1069#discussion_r319679426
 
 

 ##########
 File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/persistence/FileTxnSnapLog.java
 ##########
 @@ -232,11 +240,19 @@ public long restore(DataTree dt, Map<Long, Integer> sessions,
PlayBackListener l
         } else {
             trustEmptyDB = autoCreateDB;
         }
+
         if (-1L == deserializeResult) {
             /* this means that we couldn't find any snapshot, so we need to
              * initialize an empty database (reported in ZOOKEEPER-2325) */
             if (txnLog.getLastLoggedZxid() != -1) {
-                throw new IOException("No snapshot found, but there are log entries. " +
"Something is broken!");
+                // ZOOKEEPER-3056: provides an escape hatch for users upgrading
+                // from old versions of zookeeper (3.4.x, pre 3.5.3).
+                if (!trustEmptySnapshot) {
+                    throw new IOException(EMPTY_SNAPSHOT_WARNING + "Something is broken!");
+                } else {
+                    LOG.warn(EMPTY_SNAPSHOT_WARNING + "This should only be allowed during
upgrading.");
+                    trustEmptySnapshot = false;
+                }
             }
 
             if (trustEmptyDB) {
 
 Review comment:
   One concrete example:
   * Create a fresh zookeeper cluster with `zookeeper.db.autocreate` set to false.
   * Start a fresh cluster, create a client and issue some transactions.
   * The default snap count is 100000 so no snapshot will be created; `zookeeper.db.autocreate`
is set to false so no snapshot will be created upon server start up.
   * Now restart all zookeeper servers. We can't load because there is no snapshot. 
   
   Does this sound a reasonable example to demonstrate the problem with `trustEmptyDB ` set
to false?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message