ivankelly commented on a change in pull request #1233: ZOOKEEPER-3701 Split
brain on log disk full
URL: https://github.com/apache/zookeeper/pull/1233#discussion_r369971700
##########
File path:
zookeeper-server/src/main/java/org/apache/zookeeper/server/persistence/FileTxnSnapLog.java
##########
@@ -499,23 +499,28 @@ public void save(
* @return true if able to truncate the log, false if not
* @throws IOException
*/
- public boolean truncateLog(long zxid) throws IOException {
- // close the existing txnLog and snapLog
- close();
-
- // truncate it
- FileTxnLog truncLog = new FileTxnLog(dataDir);
- boolean truncated = truncLog.truncate(zxid);
- truncLog.close();
-
- // re-open the txnLog and snapLog
- // I'd rather just close/reopen this object itself, however that
- // would have a big impact outside ZKDatabase as there are other
- // objects holding a reference to this object.
- txnLog = new FileTxnLog(dataDir);
- snapLog = new FileSnap(snapDir);
-
- return truncated;
+ public boolean truncateLog(long zxid) {
+ try {
+ // close the existing txnLog and snapLog
+ close();
+
+ // truncate it
+ FileTxnLog truncLog = new FileTxnLog(dataDir);
+ boolean truncated = truncLog.truncate(zxid);
+ truncLog.close();
+
+ // re-open the txnLog and snapLog
+ // I'd rather just close/reopen this object itself, however that
+ // would have a big impact outside ZKDatabase as there are other
+ // objects holding a reference to this object.
+ txnLog = new FileTxnLog(dataDir);
+ snapLog = new FileSnap(snapDir);
+
+ return truncated;
+ } catch (IOException e) {
Review comment:
I'm wondering if IOException is sufficient. If you look at
https://github.com/apache/zookeeper/blob/c234848caef0cc920f19befd1b0b14251b17da92/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/Follower.java#L128
It's catching an Exception, so basically any exception other than
IOException occurring here, could kick us back into the same situation. In
fact, even the caller of Follower.followLeader() catches Exception. They're all
over QuorumPeer, with "Unexpected exception" log warnings.
I think as part of the same fix, these "Unexpected exception" errors should
also take down the process. wdyt?
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services