[ https://issues.apache.org/jira/browse/CASSANDRA-7066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14593135#comment-14593135 ]
Stefania commented on CASSANDRA-7066: ------------------------------------- [~benedict], this is ready for another round of review. Few things to notice: - During an upgrade we need to cleanup legacy tmp and tmplink files, and optionally system.compactions_in_progress sstable files. I added some code that picks up the legacy temporary files together with the new temporary files (used only for metadata generation) and deletes them. I also enhanced a preflight check to cope with them. However, I don't see why we need to do this every time. It would be ideal to check only during an upgrade, but I don't want to add one more step to the upgrade procedure either. As far as I understand users are supposed to run nodetool drain before stopping and nodetool upgradesstables after restarting, cc [~iamaleksey]. Perhaps a nodetool drain is enough to ensure no previous temporary files or we should enhance it to this effect? As for compactions_in_progress, the table is not loaded but its folder is not deleted either. It would be rather easy to enhance the new standalone tool, sstablelister, to report legacy tmp files and even compactions_in_progress sstable files so that they can be deleted, however this would be an additional manual step to perform during the upgrade. - The existing management of {{cfstore.metric.totalDiskSpaceUsed}} in the Tracker was a bit weak, in that we would decrement it without checking if we had added anything to it, we would just rely on the tracker being registered with the deleting task, which is no longer applicable. I solved it by registering another runOnGlobalRelease to decrement the counter, but perhaps you can think of something a bit cleaner. - SSTableDeletingTask is gone, there is an SSTableTidier in the TransactionLogs class that does the same job. When all the sstable tidiers have finished, we run the transaction tidier. We retry failed deletions both for the sstable tidiers and the transaction tidier. We do need to be careful to delete the txn log tracking the files to keep (the new for commit and the old for abort) as soon as the transaction is completed and in the same thread, or else we may get inconsistent behavior in getTemporaryFiles(). - I changed CQLSSTableWriter so that it has a single transaction per inner writer of SSTableSimpleUnsortedWriter, so that its behavior should be a little bit more similar to the existing behavior. > Simplify (and unify) cleanup of compaction leftovers > ---------------------------------------------------- > > Key: CASSANDRA-7066 > URL: https://issues.apache.org/jira/browse/CASSANDRA-7066 > Project: Cassandra > Issue Type: Improvement > Components: Core > Reporter: Benedict > Assignee: Stefania > Priority: Minor > Labels: compaction > Fix For: 3.x > > Attachments: 7066.txt > > > Currently we manage a list of in-progress compactions in a system table, > which we use to cleanup incomplete compactions when we're done. The problem > with this is that 1) it's a bit clunky (and leaves us in positions where we > can unnecessarily cleanup completed files, or conversely not cleanup files > that have been superceded); and 2) it's only used for a regular compaction - > no other compaction types are guarded in the same way, so can result in > duplication if we fail before deleting the replacements. > I'd like to see each sstable store in its metadata its direct ancestors, and > on startup we simply delete any sstables that occur in the union of all > ancestor sets. This way as soon as we finish writing we're capable of > cleaning up any leftovers, so we never get duplication. It's also much easier > to reason about. -- This message was sent by Atlassian JIRA (v6.3.4#6332)