[ 
https://issues.apache.org/jira/browse/CASSANDRA-7066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14329134#comment-14329134
 ] 

Benedict commented on CASSANDRA-7066:
-------------------------------------

So, I'm pretty sure this is still buggy. It also doesn't integrate well with 
the macro compaction actions. I'd like to propose a slight change to how we 
write sstables that would integrate better with when we make changes, and that 
would also eliminate TMP and TMPLINK files: basically write a mini transaction 
log file prior to any modification of the liveset, that outlines what we are 
doing, then delete it once we're done. So:

* if we're flushing a memtable we write that the new file is "in progress"
* if we're compacting multiple files into one, we write that the new file(s) 
are "in progress", then when they're done, we write a new log file saying we're 
swapping these files (as a checkpoint), then clear the "in progress" log file 
and write that we're "deleting" the old files, followed by immediately 
promoting the new ones and deleting our "swapping" log entry

On startup we just read every log file in any CF directory, and take the 
appropriate action: any "in progress" or "deleting" files are deleted; if there 
is a "swapping" log entry, we just pick up where we left off, deleting the old.

This would dovetail well with the changes I plan for CASSANDRA-8568. [~marcuse] 
[~JoshuaMcKenzie] [~yukim] [~carlyeks] thoughts?

> 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
>            Priority: Minor
>              Labels: compaction
>             Fix For: 3.0
>
>
> 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)

Reply via email to