[ https://issues.apache.org/jira/browse/ZOOKEEPER-2420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15299714#comment-15299714 ]
Ed Rowe commented on ZOOKEEPER-2420: ------------------------------------ New patch uploaded. [~hanm] as you suggested I am now using FileTxnLog.getLogFiles() to find the zxid of the oldest log file we need to retain. This change keeps the logic about "prior logs" confined to getLogFiles() which is definitely cleaner. I did not remove the filter or the comparison by zxid because it is required to prevent incorrectly deleting new snapshots/logs in a race condition - I added a comment in the new patch to discuss this case. I also refactored/renamed retainNRecentSnapshots() -> purgeOlderSnapshots() and changed it to take a single snapshot file rather than a list because it makes the interface cleaner and more obvious (the list was solely used to provide the oldest snapshot). As part of this patch I also fixed a bug in FileSnap.findNRecentSnapshots() - if there were fewer than n snapshots available then it would also return log files. > Autopurge deletes log file prior to oldest retained snapshot even though > restore may need it > -------------------------------------------------------------------------------------------- > > Key: ZOOKEEPER-2420 > URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2420 > Project: ZooKeeper > Issue Type: Bug > Components: server > Reporter: Ed Rowe > Attachments: ZOOKEEPER-2420.patch, ZOOKEEPER-2420.patch_v2 > > > Autopurge retains all log files whose zxid are >= the zxid of the oldest > snapshot file that it is going to retain (in PurgeTxnLog > retainNRecentSnapshots()). Given that loading the database from > snapshots/logs will start with the log file _prior_ to the snapshot's zxid, > autopurge should retain the log file prior to the oldest retained snapshot as > well, unless it verifies that it contains no zxids beyond what the snapshot > contains. -- This message was sent by Atlassian JIRA (v6.3.4#6332)