cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marc...@apache.org
Subject [04/10] cassandra git commit: Use Bounds instead of Range to represent sstables when deciding how to anticompact
Date Tue, 24 Apr 2018 07:01:40 GMT
Use Bounds instead of Range to represent sstables when deciding how to anticompact

Patch by marcuse; reviewed by Blake Eggleston for CASSANDRA-14411


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/334dca9a
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/334dca9a
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/334dca9a

Branch: refs/heads/trunk
Commit: 334dca9aa825e6d353aa04fd97016ac1077ff132
Parents: 594cde7
Author: Marcus Eriksson <marcuse@apache.org>
Authored: Mon Apr 23 09:13:52 2018 +0200
Committer: Marcus Eriksson <marcuse@apache.org>
Committed: Tue Apr 24 08:21:43 2018 +0200

----------------------------------------------------------------------
 CHANGES.txt                                               |  1 +
 .../apache/cassandra/db/compaction/CompactionManager.java | 10 +++++-----
 .../cassandra/db/compaction/AntiCompactionTest.java       |  2 +-
 3 files changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/334dca9a/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 967ee05..5f6189f 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.2.13
+ * Use Bounds instead of Range for sstables in anticompaction (CASSANDRA-14411)
  * Fix JSON queries with IN restrictions and ORDER BY clause (CASSANDRA-14286)
  * CQL fromJson(null) throws NullPointerException (CASSANDRA-13891)
  * Fix query pager DEBUG log leak causing hit in paged reads throughput (CASSANDRA-14318)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/334dca9a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
index d90abe9..419f66e 100644
--- a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
+++ b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
@@ -537,13 +537,13 @@ public class CompactionManager implements CompactionManagerMBean
             {
                 SSTableReader sstable = sstableIterator.next();
 
-                Range<Token> sstableRange = new Range<>(sstable.first.getToken(),
sstable.last.getToken());
+                Bounds<Token> sstableBounds = new Bounds<>(sstable.first.getToken(),
sstable.last.getToken());
 
                 boolean shouldAnticompact = false;
 
                 for (Range<Token> r : normalizedRanges)
                 {
-                    if (r.contains(sstableRange))
+                    if (r.contains(sstableBounds.left) && r.contains(sstableBounds.right))
                     {
                         logger.info("SSTable {} fully contained in range {}, mutating repairedAt
instead of anticompacting", sstable, r);
                         sstable.descriptor.getMetadataSerializer().mutateRepairedAt(sstable.descriptor,
repairedAt);
@@ -555,16 +555,16 @@ public class CompactionManager implements CompactionManagerMBean
                         shouldAnticompact = true;
                         break;
                     }
-                    else if (sstableRange.intersects(r))
+                    else if (r.intersects(sstableBounds))
                     {
-                        logger.info("SSTable {} ({}) will be anticompacted on range {}",
sstable, sstableRange, r);
+                        logger.info("SSTable {} ({}) will be anticompacted on range {}",
sstable, sstableBounds, r);
                         shouldAnticompact = true;
                     }
                 }
 
                 if (!shouldAnticompact)
                 {
-                    logger.info("SSTable {} ({}) does not intersect repaired ranges {}, not
touching repairedAt.", sstable, sstableRange, normalizedRanges);
+                    logger.info("SSTable {} ({}) does not intersect repaired ranges {}, not
touching repairedAt.", sstable, sstableBounds, normalizedRanges);
                     nonAnticompacting.add(sstable);
                     sstableIterator.remove();
                 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/334dca9a/test/unit/org/apache/cassandra/db/compaction/AntiCompactionTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/compaction/AntiCompactionTest.java b/test/unit/org/apache/cassandra/db/compaction/AntiCompactionTest.java
index 7c3fbc2..c451516 100644
--- a/test/unit/org/apache/cassandra/db/compaction/AntiCompactionTest.java
+++ b/test/unit/org/apache/cassandra/db/compaction/AntiCompactionTest.java
@@ -262,7 +262,7 @@ public class AntiCompactionTest
         ColumnFamilyStore store = prepareColumnFamilyStore();
         Collection<SSTableReader> sstables = store.getUnrepairedSSTables();
         assertEquals(store.getSSTables().size(), sstables.size());
-        Range<Token> range = new Range<Token>(new BytesToken("0".getBytes()),
new BytesToken("9999".getBytes()));
+        Range<Token> range = new Range<Token>(new BytesToken("/".getBytes()),
new BytesToken("9999".getBytes()));
         List<Range<Token>> ranges = Arrays.asList(range);
 
         try (LifecycleTransaction txn = store.getTracker().tryModify(sstables, OperationType.ANTICOMPACTION);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


Mime
View raw message