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

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

Well, a bug in the implementation could screw us up either way, and I'm not 
sure one is more robust to it than any other. But I'm certainly not terribly 
opposed to changing it again. It shouldn't be a drastic change.

However if we're doing that, I'd rather we just went with a simple log file 
that represents new and old in one. i.e., we write lines like:

{{noformat}}
add:sstable-3
remove:sstable-2
commit
{{noformat}}

commit is only written very last if we are removing the old ones and adding the 
new ones. Otherwise we rollback.

This makes the changes pretty minimal, as behaviourally it's identical, it's 
just the on-disk representation that changes. It also retains the benefit of 
not double-counting your data. If we want to be _really_ secure, we can 
post-fix each line with a checksum for the entire file (up to the point), and 
if any do not match we retain every file as a last-ditch fallback. We can also 
log panics in that case, so the operator knows for sure something bad is 
happening with their filesystem. (if only the last line does not match, and it 
is not "commit", we're as safe as we can be to rollback - but perhaps in this 
case we just log less panic-stricken warnings that they can consider deleting 
the duplicate files).

> 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: benedict-to-commit, compaction
>             Fix For: 3.0 alpha 1
>
>         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)

Reply via email to