Merge branch 'cassandra-3.0' into cassandra-3.3
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/53339a07 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/53339a07 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/53339a07 Branch: refs/heads/trunk Commit: 53339a078f905368c30ec41849c6e11d1d06c74b Parents: d094a65 1e25d19 Author: Marcus Eriksson <marc...@apache.org> Authored: Fri Jan 22 07:30:23 2016 +0100 Committer: Marcus Eriksson <marc...@apache.org> Committed: Fri Jan 22 07:30:23 2016 +0100 ---------------------------------------------------------------------- CHANGES.txt | 2 ++ .../db/compaction/LeveledManifest.java | 34 ++++++++++++++------ 2 files changed, 26 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/53339a07/CHANGES.txt ---------------------------------------------------------------------- diff --cc CHANGES.txt index ca529fc,1c2f2e2..a1ec744 --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -15,7 -11,19 +15,9 @@@ Merged from 3.0 tombstone (CASSANDRA-10743) * MV should use the maximum timestamp of the primary key (CASSANDRA-10910) * Fix potential assertion error during compaction (CASSANDRA-10944) - * Fix counting of received sstables in streaming (CASSANDRA-10949) - * Implement hints compression (CASSANDRA-9428) - * Fix potential assertion error when reading static columns (CASSANDRA-10903) - * Avoid NoSuchElementException when executing empty batch (CASSANDRA-10711) - * Avoid building PartitionUpdate in toString (CASSANDRA-10897) - * Reduce heap spent when receiving many SSTables (CASSANDRA-10797) - * Add back support for 3rd party auth providers to bulk loader (CASSANDRA-10873) - * Eliminate the dependency on jgrapht for UDT resolution (CASSANDRA-10653) - * (Hadoop) Close Clusters and Sessions in Hadoop Input/Output classes (CASSANDRA-10837) - * Fix sstableloader not working with upper case keyspace name (CASSANDRA-10806) Merged from 2.2: + * Start L0 STCS-compactions even if there is a L0 -> L1 compaction + going (CASSANDRA-10979) * Make UUID LSB unique per process (CASSANDRA-7925) * Avoid NPE when performing sstable tasks (scrub etc.) (CASSANDRA-10980) * Make sure client gets tombstone overwhelmed warning (CASSANDRA-9465) http://git-wip-us.apache.org/repos/asf/cassandra/blob/53339a07/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/db/compaction/LeveledManifest.java index c54b751,b0cd077..3246f20 --- a/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java +++ b/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java @@@ -354,10 -348,30 +348,30 @@@ public class LeveledManifes return null; Collection<SSTableReader> candidates = getCandidatesFor(0); if (candidates.isEmpty()) - return null; + { + // Since we don't have any other compactions to do, see if there is a STCS compaction to perform in L0; if + // there is a long running compaction, we want to make sure that we continue to keep the number of SSTables + // small in L0. + return getSTCSInL0CompactionCandidate(); + } - return new CompactionCandidate(candidates, getNextLevel(candidates), cfs.getCompactionStrategyManager().getMaxSSTableBytes()); + return new CompactionCandidate(candidates, getNextLevel(candidates), maxSSTableSizeInBytes); } + private CompactionCandidate getSTCSInL0CompactionCandidate() + { + if (!DatabaseDescriptor.getDisableSTCSInL0() && getLevel(0).size() > MAX_COMPACTING_L0) + { + List<SSTableReader> mostInteresting = getSSTablesForSTCS(getLevel(0)); + if (!mostInteresting.isEmpty()) + { + logger.debug("L0 is too far behind, performing size-tiering there first"); + return new CompactionCandidate(mostInteresting, 0, Long.MAX_VALUE); + } + } + + return null; + } + private List<SSTableReader> getSSTablesForSTCS(Collection<SSTableReader> sstables) { Iterable<SSTableReader> candidates = cfs.getTracker().getUncompacting(sstables);