Repository: cassandra Updated Branches: refs/heads/trunk bcb3f4713 -> 3d03b9b5a
CASSANDRA-6916 followup, make sure offline split works Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/99de2ff6 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/99de2ff6 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/99de2ff6 Branch: refs/heads/trunk Commit: 99de2ff6f60f95addc0ba6c1313d0200ce6fd512 Parents: 159e6da Author: belliottsmith <[email protected]> Authored: Fri Apr 25 08:20:11 2014 +0200 Committer: Marcus Eriksson <[email protected]> Committed: Fri Apr 25 08:21:52 2014 +0200 ---------------------------------------------------------------------- .../cassandra/db/compaction/CompactionTask.java | 3 ++- .../cassandra/db/compaction/SSTableSplitter.java | 4 ++-- .../apache/cassandra/io/sstable/SSTableRewriter.java | 15 +++++++++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/99de2ff6/src/java/org/apache/cassandra/db/compaction/CompactionTask.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/compaction/CompactionTask.java b/src/java/org/apache/cassandra/db/compaction/CompactionTask.java index 77dc7b0..c1c5504 100644 --- a/src/java/org/apache/cassandra/db/compaction/CompactionTask.java +++ b/src/java/org/apache/cassandra/db/compaction/CompactionTask.java @@ -218,7 +218,8 @@ public class CompactionTask extends AbstractCompactionTask Collection<SSTableReader> oldSStables = this.sstables; List<SSTableReader> newSStables = writer.finished(); - cfs.getDataTracker().markCompactedSSTablesReplaced(oldSStables, newSStables, compactionType); + if (!offline) + cfs.getDataTracker().markCompactedSSTablesReplaced(oldSStables, newSStables, compactionType); // log a bunch of statistics about the result and save to system table compaction_history long dTime = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start); http://git-wip-us.apache.org/repos/asf/cassandra/blob/99de2ff6/src/java/org/apache/cassandra/db/compaction/SSTableSplitter.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/compaction/SSTableSplitter.java b/src/java/org/apache/cassandra/db/compaction/SSTableSplitter.java index 67705e0..6b9f161 100644 --- a/src/java/org/apache/cassandra/db/compaction/SSTableSplitter.java +++ b/src/java/org/apache/cassandra/db/compaction/SSTableSplitter.java @@ -67,7 +67,7 @@ public class SSTableSplitter { @Override protected CompactionController getCompactionController(Set<SSTableReader> toCompact) { - return new SplitController(cfs, toCompact); + return new SplitController(cfs); } @Override @@ -85,7 +85,7 @@ public class SSTableSplitter { public static class SplitController extends CompactionController { - public SplitController(ColumnFamilyStore cfs, Collection<SSTableReader> toCompact) + public SplitController(ColumnFamilyStore cfs) { super(cfs, CompactionManager.NO_GC); } http://git-wip-us.apache.org/repos/asf/cassandra/blob/99de2ff6/src/java/org/apache/cassandra/io/sstable/SSTableRewriter.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/io/sstable/SSTableRewriter.java b/src/java/org/apache/cassandra/io/sstable/SSTableRewriter.java index 2dfefc4..553993a 100644 --- a/src/java/org/apache/cassandra/io/sstable/SSTableRewriter.java +++ b/src/java/org/apache/cassandra/io/sstable/SSTableRewriter.java @@ -37,6 +37,21 @@ import org.apache.cassandra.db.compaction.AbstractCompactedRow; import org.apache.cassandra.db.compaction.OperationType; import org.apache.cassandra.utils.CLibrary; +/** + * Wraps one or more writers as output for rewriting one or more readers: every sstable_preemptive_open_interval_in_mb + * we look in the summary we're collecting for the latest writer for the penultimate key that we know to have been fully + * flushed to the index file, and then double check that the key is fully present in the flushed data file. + * Then we move the starts of each reader forwards to that point, replace them in the datatracker, and attach a runnable + * for on-close (i.e. when all references expire) that drops the page cache prior to that key position + * + * hard-links are created for each partially written sstable so that readers opened against them continue to work past + * the rename of the temporary file, which is deleted once all readers against the hard-link have been closed. + * If for any reason the writer is rolled over, we immediately rename and fully expose the completed file in the DataTracker. + * + * On abort we restore the original lower bounds to the existing readers and delete any temporary files we had in progress, + * but leave any hard-links in place for the readers we opened to cleanup when they're finished as we would had we finished + * successfully. + */ public class SSTableRewriter {
