cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marc...@apache.org
Subject [2/3] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Date Thu, 10 Sep 2015 12:44:35 GMT
Merge branch 'cassandra-2.1' into cassandra-2.2

Conflicts:
	src/java/org/apache/cassandra/db/compaction/CompactionManager.java
	test/unit/org/apache/cassandra/db/compaction/AntiCompactionTest.java


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

Branch: refs/heads/cassandra-3.0
Commit: 362da9bbc1cf64be0c6ec373e6602822b1138173
Parents: b22ad42 9dd8471
Author: Marcus Eriksson <marcuse@apache.org>
Authored: Thu Sep 10 14:35:37 2015 +0200
Committer: Marcus Eriksson <marcuse@apache.org>
Committed: Thu Sep 10 14:35:37 2015 +0200

----------------------------------------------------------------------
 .../db/compaction/CompactionManager.java        | 28 +++++++++++++-------
 .../db/compaction/AntiCompactionTest.java       |  4 +--
 2 files changed, 20 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/362da9bb/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/compaction/CompactionManager.java
index 495c5ab,e60675a..7def98d
--- a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
+++ b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
@@@ -471,9 -445,13 +473,13 @@@ public class CompactionManager implemen
              while (sstableIterator.hasNext())
              {
                  SSTableReader sstable = sstableIterator.next();
-                 for (Range<Token> r : Range.normalize(ranges))
+ 
 -                Range<Token> sstableRange = new Range<>(sstable.first.getToken(),
sstable.last.getToken(), sstable.partitioner);
++                Range<Token> sstableRange = new Range<>(sstable.first.getToken(),
sstable.last.getToken());
+ 
+                 boolean shouldAnticompact = false;
+ 
+                 for (Range<Token> r : normalizedRanges)
                  {
-                     Range<Token> sstableRange = new Range<>(sstable.first.getToken(),
sstable.last.getToken());
                      if (r.contains(sstableRange))
                      {
                          logger.info("SSTable {} fully contained in range {}, mutating repairedAt
instead of anticompacting", sstable, r);
@@@ -481,28 -459,28 +487,30 @@@
                          sstable.reloadSSTableMetadata();
                          mutatedRepairStatuses.add(sstable);
                          sstableIterator.remove();
+                         shouldAnticompact = true;
                          break;
                      }
-                     else if (!sstableRange.intersects(r))
-                     {
-                         logger.info("SSTable {} ({}) does not intersect repaired range {},
not touching repairedAt.", sstable, sstableRange, r);
-                         nonAnticompacting.add(sstable);
-                         sstableIterator.remove();
-                         break;
-                     }
-                     else
+                     else if (sstableRange.intersects(r))
                      {
                          logger.info("SSTable {} ({}) will be anticompacted on range {}",
sstable, sstableRange, r);
+                         shouldAnticompact = true;
                      }
                  }
+ 
+                 if (!shouldAnticompact)
+                 {
+                     logger.info("SSTable {} ({}) does not intersect repaired ranges {},
not touching repairedAt.", sstable, sstableRange, normalizedRanges);
+                     nonAnticompacting.add(sstable);
+                     sstableIterator.remove();
+                 }
              }
 -            cfs.getDataTracker().notifySSTableRepairedStatusChanged(mutatedRepairStatuses);
 -            cfs.getDataTracker().unmarkCompacting(Sets.union(nonAnticompacting, mutatedRepairStatuses));
 +            cfs.getTracker().notifySSTableRepairedStatusChanged(mutatedRepairStatuses);
 +            txn.cancel(Sets.union(nonAnticompacting, mutatedRepairStatuses));
              validatedForRepair.release(Sets.union(nonAnticompacting, mutatedRepairStatuses));
 +            assert txn.originals().equals(sstables);
              if (!sstables.isEmpty())
 -                doAntiCompaction(cfs, ranges, sstables, repairedAt);
 +                doAntiCompaction(cfs, ranges, txn, repairedAt);
 +            txn.finish();
          }
          finally
          {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/362da9bb/test/unit/org/apache/cassandra/db/compaction/AntiCompactionTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/compaction/AntiCompactionTest.java
index 235462b,56af801..7c3fbc2
--- a/test/unit/org/apache/cassandra/db/compaction/AntiCompactionTest.java
+++ b/test/unit/org/apache/cassandra/db/compaction/AntiCompactionTest.java
@@@ -278,34 -179,6 +278,34 @@@ public class AntiCompactionTes
      }
  
  
 +    @Test
 +    public void shouldSkipAntiCompactionForNonIntersectingRange() throws InterruptedException,
IOException
 +    {
 +        Keyspace keyspace = Keyspace.open(KEYSPACE1);
 +        ColumnFamilyStore store = keyspace.getColumnFamilyStore(CF);
 +        store.disableAutoCompaction();
 +
 +        for (int table = 0; table < 10; table++)
 +        {
 +            generateSStable(store,Integer.toString(table));
 +        }
 +        Collection<SSTableReader> sstables = store.getUnrepairedSSTables();
 +        assertEquals(store.getSSTables().size(), sstables.size());
 +        
-         Range<Token> range = new Range<Token>(new BytesToken("-10".getBytes()),
new BytesToken("-1".getBytes()));
++        Range<Token> range = new Range<Token>(new BytesToken("-1".getBytes()),
new BytesToken("-10".getBytes()));
 +        List<Range<Token>> ranges = Arrays.asList(range);
 +
 +
 +        try (LifecycleTransaction txn = store.getTracker().tryModify(sstables, OperationType.ANTICOMPACTION);
 +             Refs<SSTableReader> refs = Refs.ref(sstables))
 +        {
-             CompactionManager.instance.performAnticompaction(store, ranges, refs, txn, 0);
++            CompactionManager.instance.performAnticompaction(store, ranges, refs, txn, 1);
 +        }
 +
 +        assertThat(store.getSSTables().size(), is(10));
 +        assertThat(Iterables.get(store.getSSTables(), 0).isRepaired(), is(false));
 +    }
 +
      private ColumnFamilyStore prepareColumnFamilyStore()
      {
          Keyspace keyspace = Keyspace.open(KEYSPACE1);


Mime
View raw message