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 Wed, 28 Oct 2015 08:10:30 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/5a356a70
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/5a356a70
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/5a356a70

Branch: refs/heads/cassandra-3.0
Commit: 5a356a70631d50cbab0f01dbfea868f26af66582
Parents: 40cef77 cedcf07
Author: Marcus Eriksson <marcuse@apache.org>
Authored: Wed Oct 28 08:43:10 2015 +0100
Committer: Marcus Eriksson <marcuse@apache.org>
Committed: Wed Oct 28 08:50:44 2015 +0100

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../DateTieredCompactionStrategy.java           | 46 ++++++++++------
 .../DateTieredCompactionStrategyTest.java       | 57 ++++++++++++++------
 3 files changed, 72 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/5a356a70/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 24862b0,5b46eac..9021e9d
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,10 -1,5 +1,11 @@@
 -2.1.12
 +2.2.4
 + * 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:
+  * Do STCS in DTCS windows (CASSANDRA-10276)
   * Don't try to get ancestors from half-renamed sstables (CASSANDRA-10501)
   * Avoid repetition of JVM_OPTS in debian package (CASSANDRA-10251)
   * Fix potential NPE from handling result of SIM.highestSelectivityIndex (CASSANDRA-10550)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5a356a70/src/java/org/apache/cassandra/db/compaction/DateTieredCompactionStrategy.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/compaction/DateTieredCompactionStrategy.java
index da2d35d,ece596f..fe8f135
--- a/src/java/org/apache/cassandra/db/compaction/DateTieredCompactionStrategy.java
+++ b/src/java/org/apache/cassandra/db/compaction/DateTieredCompactionStrategy.java
@@@ -50,11 -49,12 +50,12 @@@ public class DateTieredCompactionStrate
          if (!options.containsKey(AbstractCompactionStrategy.TOMBSTONE_COMPACTION_INTERVAL_OPTION)
&& !options.containsKey(AbstractCompactionStrategy.TOMBSTONE_THRESHOLD_OPTION))
          {
              disableTombstoneCompactions = true;
 -            logger.debug("Disabling tombstone compactions for DTCS");
 +            logger.trace("Disabling tombstone compactions for DTCS");
          }
          else
 -            logger.debug("Enabling tombstone compactions for DTCS");
 +            logger.trace("Enabling tombstone compactions for DTCS");
  
+         this.stcsOptions = new SizeTieredCompactionStrategyOptions(options);
      }
  
      @Override
@@@ -372,14 -379,13 +382,14 @@@
      }
  
      @Override
 -    public synchronized Collection<AbstractCompactionTask> getMaximalTask(int gcBefore)
 +    @SuppressWarnings("resource")
 +    public synchronized Collection<AbstractCompactionTask> getMaximalTask(int gcBefore,
boolean splitOutput)
      {
 -        Iterable<SSTableReader> sstables = cfs.markAllCompacting();
 -        if (sstables == null)
 +        LifecycleTransaction modifier = cfs.markAllCompacting(OperationType.COMPACTION);
 +        if (modifier == null)
              return null;
  
-         return Arrays.<AbstractCompactionTask>asList(new CompactionTask(cfs, modifier,
gcBefore, false));
 -        return Collections.<AbstractCompactionTask>singleton(new CompactionTask(cfs,
sstables, gcBefore, false));
++        return Collections.<AbstractCompactionTask>singleton(new CompactionTask(cfs,
modifier, gcBefore, false));
      }
  
      @Override

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5a356a70/test/unit/org/apache/cassandra/db/compaction/DateTieredCompactionStrategyTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/compaction/DateTieredCompactionStrategyTest.java
index 0159c83,368101d..2824d3a
--- a/test/unit/org/apache/cassandra/db/compaction/DateTieredCompactionStrategyTest.java
+++ b/test/unit/org/apache/cassandra/db/compaction/DateTieredCompactionStrategyTest.java
@@@ -325,10 -301,50 +312,50 @@@ public class DateTieredCompactionStrate
          Thread.sleep(2000);
          AbstractCompactionTask t = dtcs.getNextBackgroundTask((int) (System.currentTimeMillis()/1000));
          assertNotNull(t);
 -        assertEquals(1, Iterables.size(t.sstables));
 -        SSTableReader sstable = t.sstables.iterator().next();
 +        assertEquals(1, Iterables.size(t.transaction.originals()));
 +        SSTableReader sstable = t.transaction.originals().iterator().next();
          assertEquals(sstable, expiredSSTable);
 -        cfs.getDataTracker().unmarkCompacting(cfs.getSSTables());
 +        t.transaction.abort();
      }
  
+     @Test
+     public void testSTCSBigWindow()
+     {
+         Keyspace keyspace = Keyspace.open(KEYSPACE1);
+         ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(CF_STANDARD1);
+         cfs.truncateBlocking();
+         cfs.disableAutoCompaction();
+         ByteBuffer bigValue = ByteBuffer.wrap(new byte[10000]);
+         ByteBuffer value = ByteBuffer.wrap(new byte[100]);
+         int numSSTables = 40;
+         // create big sstabels out of half:
+         long timestamp = System.currentTimeMillis();
+         for (int r = 0; r < numSSTables / 2; r++)
+         {
+             for (int i = 0; i < 10; i++)
+             {
+                 DecoratedKey key = Util.dk(String.valueOf(r));
+                 Mutation rm = new Mutation(KEYSPACE1, key.getKey());
+                 rm.add(CF_STANDARD1, Util.cellname("column"), bigValue, timestamp);
+                 rm.apply();
+             }
+             cfs.forceBlockingFlush();
+         }
+         // and small ones:
+         for (int r = 0; r < numSSTables / 2; r++)
+         {
+             DecoratedKey key = Util.dk(String.valueOf(r));
+             Mutation rm = new Mutation(KEYSPACE1, key.getKey());
+             rm.add(CF_STANDARD1, Util.cellname("column"), value, timestamp);
+             rm.apply();
+             cfs.forceBlockingFlush();
+         }
+         Map<String, String> options = new HashMap<>();
+         options.put(SizeTieredCompactionStrategyOptions.MIN_SSTABLE_SIZE_KEY, "1");
+         DateTieredCompactionStrategy dtcs = new DateTieredCompactionStrategy(cfs, options);
+         for (SSTableReader sstable : cfs.getSSTables())
+             dtcs.addSSTable(sstable);
 -        assertEquals(20, dtcs.getNextBackgroundTask(0).sstables.size());
++        assertEquals(20, dtcs.getNextBackgroundTask(0).transaction.originals().size());
+     }
+ 
  }


Mime
View raw message