Repository: cassandra Updated Branches: refs/heads/trunk eda2613bc -> c413b6dee
Delete untracked non-CDC hard link log files in cdc_raw after replaying Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/31bcefe7 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/31bcefe7 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/31bcefe7 Branch: refs/heads/trunk Commit: 31bcefe7369291a2b71a9815f32e40bad604fbb6 Parents: d38694a Author: Shichao An <[email protected]> Authored: Wed Mar 28 15:07:57 2018 -0700 Committer: Shichao An <[email protected]> Committed: Wed Mar 28 16:40:13 2018 -0700 ---------------------------------------------------------------------- .../commitlog/CommitLogSegmentManagerCDC.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/31bcefe7/src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManagerCDC.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManagerCDC.java b/src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManagerCDC.java index 4d31aad..bdd4f74 100644 --- a/src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManagerCDC.java +++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManagerCDC.java @@ -153,6 +153,26 @@ public class CommitLogSegmentManagerCDC extends AbstractCommitLogSegmentManager } /** + * Delete untracked segment files after replay + * + * @param file segment file that is no longer in use. + */ + @Override + void handleReplayedSegment(final File file) + { + super.handleReplayedSegment(file); + + // delete untracked cdc segment hard link files if their index files do not exist + File cdcFile = new File(DatabaseDescriptor.getCDCLogLocation(), file.getName()); + File cdcIndexFile = new File(DatabaseDescriptor.getCDCLogLocation(), CommitLogDescriptor.fromFileName(file.getName()).cdcIndexFileName()); + if (cdcFile.exists() && !cdcIndexFile.exists()) + { + logger.trace("(Unopened) CDC segment {} is no longer needed and will be deleted now", cdcFile); + FileUtils.deleteWithConfirm(cdcFile); + } + } + + /** * For use after replay when replayer hard-links / adds tracking of replayed segments */ public void addCDCSize(long size) --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
