zookeeper-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [zookeeper] lvfangmin commented on a change in pull request #982: ZOOKEEPER-1621: Delete and skip txn log with incomplete header
Date Wed, 19 Jun 2019 20:35:59 GMT
lvfangmin commented on a change in pull request #982: ZOOKEEPER-1621: Delete and skip txn log
with incomplete header
URL: https://github.com/apache/zookeeper/pull/982#discussion_r295512194
 
 

 ##########
 File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/persistence/FileTxnLog.java
 ##########
 @@ -690,10 +691,30 @@ public long getStorageSize() {
          * @throws IOException
          */
         private boolean goToNextLog() throws IOException {
-            if (storedFiles.size() > 0) {
+            while (storedFiles.size() > 0) {
                 this.logFile = storedFiles.remove(storedFiles.size()-1);
-                ia = createInputArchive(this.logFile);
-                return true;
+                try {
+                    ia = createInputArchive(this.logFile);
+                    return true;
+                } catch (StreamCorruptedException ex) {
+                    // The magic number is corrupted. We shouldn't simply skip
+                    // this log file since it might contain transactions that
+                    // have already been acknowledged.
+                    throw ex;
+                } catch (EOFException ex) {
 
 Review comment:
   EOFException could throw if the txn file is corrupted as well, right? For example, the
txn file is truncated to only including the magic and version, but not dbid field.
   
   It may not safe to just delete the txn file and move on.

----------------------------------------------------------------
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