You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ma...@apache.org on 2016/01/29 08:18:00 UTC
[04/15] cassandra git commit: Backport CASSANDRA-10979 to 2.1
Backport CASSANDRA-10979 to 2.1
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/3b794f0a
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/3b794f0a
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/3b794f0a
Branch: refs/heads/cassandra-3.0
Commit: 3b794f0a82e26c7a6b3fd8baf5ebd6ae9ed814ea
Parents: d5b6d1b
Author: Marcus Eriksson <ma...@apache.org>
Authored: Fri Jan 29 08:13:20 2016 +0100
Committer: Marcus Eriksson <ma...@apache.org>
Committed: Fri Jan 29 08:13:20 2016 +0100
----------------------------------------------------------------------
.../db/compaction/LeveledManifest.java | 34 ++++++++++++++------
1 file changed, 24 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/3b794f0a/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java b/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
index 1e67a9e..622d68b 100644
--- a/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
+++ b/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
@@ -313,15 +313,9 @@ public class LeveledManifest
if (score > 1.001)
{
// before proceeding with a higher level, let's see if L0 is far enough behind to warrant STCS
- 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);
- }
- }
+ CompactionCandidate l0Compaction = getSTCSInL0CompactionCandidate();
+ if (l0Compaction != null)
+ return l0Compaction;
// L0 is fine, proceed with this level
Collection<SSTableReader> candidates = getCandidatesFor(i);
@@ -345,10 +339,30 @@ public class LeveledManifest
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.getCompactionStrategy().getMaxSSTableBytes());
}
+ 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.getDataTracker().getUncompactingSSTables(sstables);