cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marc...@apache.org
Subject [2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Date Wed, 18 Nov 2015 13:01:37 GMT
Merge branch 'cassandra-2.1' into cassandra-2.2


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

Branch: refs/heads/trunk
Commit: d09b6c69e0e0c6adff8e679f2286a335d883f1bd
Parents: 077f9bf 246cb88
Author: Marcus Eriksson <marcuse@apache.org>
Authored: Wed Nov 18 13:59:09 2015 +0100
Committer: Marcus Eriksson <marcuse@apache.org>
Committed: Wed Nov 18 13:59:09 2015 +0100

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../compaction/WrappingCompactionStrategy.java  | 16 +++++++++
 .../LeveledCompactionStrategyTest.java          | 35 ++++++++++++++++++++
 3 files changed, 52 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/d09b6c69/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 572afc2,6ccde28..c3dacc2
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,17 -1,5 +1,18 @@@
 -2.1.12
 +2.2.4
 + * Don't do anticompaction after subrange repair (CASSANDRA-10422)
 + * Fix SimpleDateType type compatibility (CASSANDRA-10027)
 + * (Hadoop) fix splits calculation (CASSANDRA-10640)
 + * (Hadoop) ensure that Cluster instances are always closed (CASSANDRA-10058)
 + * (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645)
 + * Use most up-to-date version of schema for system tables (CASSANDRA-10652)
 + * Deprecate memory_allocator in cassandra.yaml (CASSANDRA-10581,10628)
 + * Expose phi values from failure detector via JMX and tweak debug
 +   and trace logging (CASSANDRA-9526)
 + * Fix RangeNamesQueryPager (CASSANDRA-10509)
 + * Deprecate Pig support (CASSANDRA-10542)
 + * Reduce contention getting instances of CompositeType (CASSANDRA-10433)
 +Merged from 2.1:
+  * Don't remove level info when running upgradesstables (CASSANDRA-10692)
   * Create compression chunk for sending file only (CASSANDRA-10680)
   * Make buffered read size configurable (CASSANDRA-10249)
   * Forbid compact clustering column type changes in ALTER TABLE (CASSANDRA-8879)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/d09b6c69/src/java/org/apache/cassandra/db/compaction/WrappingCompactionStrategy.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/compaction/WrappingCompactionStrategy.java
index 9daa0c5,71a6bc1..8555432
--- a/src/java/org/apache/cassandra/db/compaction/WrappingCompactionStrategy.java
+++ b/src/java/org/apache/cassandra/db/compaction/WrappingCompactionStrategy.java
@@@ -32,10 -32,10 +32,11 @@@ import org.slf4j.LoggerFactory
  
  import org.apache.cassandra.config.CFMetaData;
  import org.apache.cassandra.db.ColumnFamilyStore;
++import org.apache.cassandra.db.lifecycle.LifecycleTransaction;
  import org.apache.cassandra.dht.Range;
  import org.apache.cassandra.dht.Token;
 +import org.apache.cassandra.io.sstable.format.SSTableReader;
  import org.apache.cassandra.io.sstable.ISSTableScanner;
 -import org.apache.cassandra.io.sstable.SSTableReader;
  import org.apache.cassandra.notifications.INotification;
  import org.apache.cassandra.notifications.INotificationConsumer;
  import org.apache.cassandra.notifications.SSTableAddedNotification;
@@@ -123,6 -123,21 +124,21 @@@ public final class WrappingCompactionSt
      }
  
      @Override
 -    public AbstractCompactionTask getCompactionTask(Collection<SSTableReader> sstables,
final int gcBefore, long maxSSTableBytes)
++    public AbstractCompactionTask getCompactionTask(LifecycleTransaction txn, final int
gcBefore, long maxSSTableBytes)
+     {
 -        assert sstables.size() > 0;
 -        boolean repairedSSTables = sstables.iterator().next().isRepaired();
 -        for (SSTableReader sstable : sstables)
++        assert txn.originals().size() > 0;
++        boolean repairedSSTables = txn.originals().iterator().next().isRepaired();
++        for (SSTableReader sstable : txn.originals())
+             if (repairedSSTables != sstable.isRepaired())
+                 throw new RuntimeException("Can't mix repaired and unrepaired sstables in
a compaction");
+ 
+         if (repairedSSTables)
 -            return repaired.getCompactionTask(sstables, gcBefore, maxSSTableBytes);
++            return repaired.getCompactionTask(txn, gcBefore, maxSSTableBytes);
+         else
 -            return unrepaired.getCompactionTask(sstables, gcBefore, maxSSTableBytes);
++            return unrepaired.getCompactionTask(txn, gcBefore, maxSSTableBytes);
+     }
+ 
+     @Override
      public synchronized AbstractCompactionTask getUserDefinedTask(Collection<SSTableReader>
sstables, int gcBefore)
      {
          assert !sstables.isEmpty();

http://git-wip-us.apache.org/repos/asf/cassandra/blob/d09b6c69/test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java
index 6b3383e,cb9cbb4..510ed97
--- a/test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java
+++ b/test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java
@@@ -20,18 -20,13 +20,19 @@@ package org.apache.cassandra.db.compact
  import java.nio.ByteBuffer;
  import java.util.Arrays;
  import java.util.Collection;
 +import java.util.HashMap;
 +import java.util.Iterator;
  import java.util.List;
 +import java.util.Map;
  import java.util.Random;
  import java.util.UUID;
+ import java.util.concurrent.ExecutionException;
  
 +import org.apache.cassandra.io.sstable.format.SSTableReader;
 +import junit.framework.Assert;
  import org.junit.After;
  import org.junit.Before;
 +import org.junit.BeforeClass;
  import org.junit.Test;
  import org.junit.runner.RunWith;
  
@@@ -365,4 -279,38 +366,38 @@@ public class LeveledCompactionStrategyT
          assertTrue(unrepaired.manifest.getLevel(1).contains(sstable2));
          assertFalse(repaired.manifest.getLevel(1).contains(sstable2));
      }
+ 
+     @Test
+     public void testDontRemoveLevelInfoUpgradeSSTables() throws InterruptedException, ExecutionException
+     {
+         byte [] b = new byte[100 * 1024];
+         new Random().nextBytes(b);
+         ByteBuffer value = ByteBuffer.wrap(b); // 100 KB value, make it easy to have multiple
files
+ 
+         // Enough data to have a level 1 and 2
+         int rows = 20;
+         int columns = 10;
+ 
+         // Adds enough data to trigger multiple sstable per level
+         for (int r = 0; r < rows; r++)
+         {
+             DecoratedKey key = Util.dk(String.valueOf(r));
 -            Mutation rm = new Mutation(ksname, key.getKey());
++            Mutation rm = new Mutation(KEYSPACE1, key.getKey());
+             for (int c = 0; c < columns; c++)
+             {
 -                rm.add(cfname, Util.cellname("column" + c), value, 0);
++                rm.add(CF_STANDARDDLEVELED, Util.cellname("column" + c), value, 0);
+             }
+             rm.apply();
+             cfs.forceBlockingFlush();
+         }
+         waitForLeveling(cfs);
+         cfs.forceBlockingFlush();
+         LeveledCompactionStrategy strategy = (LeveledCompactionStrategy) ((WrappingCompactionStrategy)
cfs.getCompactionStrategy()).getWrappedStrategies().get(1);
+         assertTrue(strategy.getAllLevelSize()[1] > 0);
+ 
+         cfs.disableAutoCompaction();
+         cfs.sstablesRewrite(false);
+         assertTrue(strategy.getAllLevelSize()[1] > 0);
+ 
+     }
  }


Mime
View raw message