cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yu...@apache.org
Subject [05/10] cassandra git commit: Merge branch 'cassandra-2.2' into cassandra-3.0
Date Thu, 23 Feb 2017 02:14:26 GMT
Merge branch 'cassandra-2.2' into cassandra-3.0


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

Branch: refs/heads/cassandra-3.11
Commit: 61f0c988f78c00fec2c4e028cfb793b84069f737
Parents: 51796ea 6ffd5cc
Author: Yuki Morishita <yukim@apache.org>
Authored: Thu Feb 23 11:01:32 2017 +0900
Committer: Yuki Morishita <yukim@apache.org>
Committed: Thu Feb 23 11:01:32 2017 +0900

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../LongLeveledCompactionStrategyTest.java      | 58 ++++++++++++--------
 .../LeveledCompactionStrategyTest.java          |  2 +-
 3 files changed, 37 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/61f0c988/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index afda236,033b366..e978a5c
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,7 -1,5 +1,8 @@@
 -2.2.10
 +3.0.12
 + * Remove unnecessary assertion from AntiCompactionTest (CASSANDRA-13070)
 + * Fix cqlsh COPY for dates before 1900 (CASSANDRA-13185)
 +Merged from 2.2
+  * Fix flaky LongLeveledCompactionStrategyTest (CASSANDRA-12202)
   * Fix failing COPY TO STDOUT (CASSANDRA-12497)
   * Fix ColumnCounter::countAll behaviour for reverse queries (CASSANDRA-13222)
   * Exceptions encountered calling getSeeds() breaks OTC thread (CASSANDRA-13018)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/61f0c988/test/long/org/apache/cassandra/db/compaction/LongLeveledCompactionStrategyTest.java
----------------------------------------------------------------------
diff --cc test/long/org/apache/cassandra/db/compaction/LongLeveledCompactionStrategyTest.java
index 79497aa,8e63006..562de22
--- a/test/long/org/apache/cassandra/db/compaction/LongLeveledCompactionStrategyTest.java
+++ b/test/long/org/apache/cassandra/db/compaction/LongLeveledCompactionStrategyTest.java
@@@ -53,9 -51,14 +55,11 @@@ public class LongLeveledCompactionStrat
          leveledOptions.put("sstable_size_in_mb", "1");
          SchemaLoader.prepareServer();
          SchemaLoader.createKeyspace(KEYSPACE1,
 -                                    SimpleStrategy.class,
 -                                    KSMetaData.optsWithRF(1),
 +                                    KeyspaceParams.simple(1),
                                      SchemaLoader.standardCFMD(KEYSPACE1, CF_STANDARDLVL)
 -                                                .compactionStrategyClass(LeveledCompactionStrategy.class)
 -                                                .compactionStrategyOptions(leveledOptions),
++                                                .compaction(CompactionParams.lcs(leveledOptions)),
+                                     SchemaLoader.standardCFMD(KEYSPACE1, CF_STANDARDLVL2)
 -                                                .compactionStrategyClass(LeveledCompactionStrategy.class)
 -                                                .compactionStrategyOptions(leveledOptions));
 +                                                .compaction(CompactionParams.lcs(leveledOptions)));
      }
  
      @Test
@@@ -145,15 -149,34 +149,14 @@@
      @Test
      public void testLeveledScanner() throws Exception
      {
-         testParallelLeveledCompaction();
          Keyspace keyspace = Keyspace.open(KEYSPACE1);
-         ColumnFamilyStore store = keyspace.getColumnFamilyStore(CF_STANDARDLVL);
 -        final ColumnFamilyStore store = keyspace.getColumnFamilyStore(CF_STANDARDLVL2);
 -        WrappingCompactionStrategy strategy = ((WrappingCompactionStrategy) store.getCompactionStrategy());
 -        final LeveledCompactionStrategy lcs = (LeveledCompactionStrategy) strategy.getWrappedStrategies().get(1);
 -
 -        ByteBuffer value = ByteBuffer.wrap(new byte[100 * 1024]); // 100 KB value, make
it easy to have multiple files
++        ColumnFamilyStore store = keyspace.getColumnFamilyStore(CF_STANDARDLVL2);
 +        store.disableAutoCompaction();
  
 -        // Enough data to have a level 1 and 2
 -        int rows = 128;
 -        int columns = 10;
 +        LeveledCompactionStrategy lcs = (LeveledCompactionStrategy)store.getCompactionStrategyManager().getStrategies().get(1);
  
-         ByteBuffer value = ByteBuffer.wrap(new byte[10 * 1024]); // 10 KB value
 -        // 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(KEYSPACE1, key.getKey());
 -            for (int c = 0; c < columns; c++)
 -            {
 -                rm.add(CF_STANDARDLVL2, Util.cellname("column" + c), value, 0);
 -            }
 -            rm.apply();
 -            store.forceBlockingFlush();
 -        }
++        ByteBuffer value = ByteBuffer.wrap(new byte[100 * 1024]); // 100 KB value, make
it easy to have multiple files
  
 -        value = ByteBuffer.wrap(new byte[10 * 1024]); // 10 KB value
 -        LeveledCompactionStrategyTest.waitForLeveling(store);
 -        // wait for higher-level compactions to finish
 -        store.disableAutoCompaction();
          // Adds 10 partitions
          for (int r = 0; r < 10; r++)
          {
@@@ -169,33 -192,40 +172,42 @@@
          //Flush sstable
          store.forceBlockingFlush();
  
-         Iterable<SSTableReader> allSSTables = store.getSSTables(SSTableSet.LIVE);
-         for (SSTableReader sstable : allSSTables)
+         store.runWithCompactionsDisabled(new Callable<Void>()
          {
-             if (sstable.getSSTableLevel() == 0)
+             public Void call() throws Exception
              {
-                 System.out.println("Mutating L0-SSTABLE level to L1 to simulate a bug: "
+ sstable.getFilename());
-                 sstable.descriptor.getMetadataSerializer().mutateLevel(sstable.descriptor,
1);
-                 sstable.reloadSSTableMetadata();
-             }
-         }
 -                Collection<SSTableReader> allSSTables = store.getSSTables();
++                Iterable<SSTableReader> allSSTables = store.getSSTables(SSTableSet.LIVE);
+                 for (SSTableReader sstable : allSSTables)
+                 {
+                     if (sstable.getSSTableLevel() == 0)
+                     {
+                         System.out.println("Mutating L0-SSTABLE level to L1 to simulate
a bug: " + sstable.getFilename());
+                         sstable.descriptor.getMetadataSerializer().mutateLevel(sstable.descriptor,
1);
+                         sstable.reloadSSTableMetadata();
+                     }
+                 }
  
-         try (AbstractCompactionStrategy.ScannerList scannerList = lcs.getScanners(Lists.newArrayList(allSSTables)))
-         {
-             //Verify that leveled scanners will always iterate in ascending order (CASSANDRA-9935)
-             for (ISSTableScanner scanner : scannerList.scanners)
-             {
-                 DecoratedKey lastKey = null;
-                 while (scanner.hasNext())
 -                try (AbstractCompactionStrategy.ScannerList scannerList = lcs.getScanners(allSSTables))
++                try (AbstractCompactionStrategy.ScannerList scannerList = lcs.getScanners(Lists.newArrayList(allSSTables)))
                  {
-                     UnfilteredRowIterator row = scanner.next();
-                     if (lastKey != null)
+                     //Verify that leveled scanners will always iterate in ascending order
(CASSANDRA-9935)
+                     for (ISSTableScanner scanner : scannerList.scanners)
                      {
-                         assertTrue("row " + row.partitionKey() + " received out of order
wrt " + lastKey, row.partitionKey().compareTo(lastKey) >= 0);
+                         DecoratedKey lastKey = null;
+                         while (scanner.hasNext())
+                         {
 -                            OnDiskAtomIterator row = scanner.next();
++                            UnfilteredRowIterator row = scanner.next();
+                             if (lastKey != null)
+                             {
 -                                assertTrue("row " + row.getKey() + " received out of order
wrt " + lastKey, row.getKey().compareTo(lastKey) >= 0);
++                                assertTrue("row " + row.partitionKey() + " received out
of order wrt " + lastKey, row.partitionKey().compareTo(lastKey) >= 0);
+                             }
 -                            lastKey = row.getKey();
++                            lastKey = row.partitionKey();
+                         }
                      }
-                     lastKey = row.partitionKey();
                  }
+                 return null;
              }
-         }
 -        }, true);
++        }, true, true);
++
++
      }
  }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/61f0c988/test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java
index 1277209,0047678..636afe1
--- a/test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java
+++ b/test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java
@@@ -194,9 -207,9 +194,9 @@@ public class LeveledCompactionStrategyT
      /**
       * wait for leveled compaction to quiesce on the given columnfamily
       */
-     private void waitForLeveling(ColumnFamilyStore cfs) throws InterruptedException
+     public static void waitForLeveling(ColumnFamilyStore cfs) throws InterruptedException
      {
 -        WrappingCompactionStrategy strategyManager = (WrappingCompactionStrategy)cfs.getCompactionStrategy();
 +        CompactionStrategyManager strategyManager = cfs.getCompactionStrategyManager();
          while (true)
          {
              // since we run several compaction strategies we wait until L0 in all strategies
is empty and


Mime
View raw message