cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marc...@apache.org
Subject [02/10] cassandra git commit: Notify that sstables were changed after compaction was cancelled
Date Tue, 29 Mar 2016 09:23:17 GMT
Notify that sstables were changed after compaction was cancelled

Patch by marcuse; reviewed by benedict for CASSANDRA-11373


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

Branch: refs/heads/cassandra-3.0
Commit: aefea62a065bbb400242c5adf412da8e3e21a147
Parents: 897ffe8
Author: Marcus Eriksson <marcuse@apache.org>
Authored: Tue Mar 22 09:24:35 2016 +0100
Committer: Marcus Eriksson <marcuse@apache.org>
Committed: Tue Mar 29 11:16:32 2016 +0200

----------------------------------------------------------------------
 CHANGES.txt                                                     | 1 +
 .../org/apache/cassandra/db/lifecycle/LifecycleTransaction.java | 5 ++++-
 .../org/apache/cassandra/io/sstable/SSTableRewriterTest.java    | 3 +++
 3 files changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/aefea62a/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 098d062..5e8828b 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.2.6
+ * Notify when sstables change after cancelling compaction (CASSANDRA-11373)
  * cqlsh: COPY FROM should check that explicit column names are valid (CASSANDRA-11333)
  * Add -Dcassandra.start_gossip startup option (CASSANDRA-10809)
  * Fix UTF8Validator.validate() for modified UTF-8 (CASSANDRA-10748)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aefea62a/src/java/org/apache/cassandra/db/lifecycle/LifecycleTransaction.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/lifecycle/LifecycleTransaction.java b/src/java/org/apache/cassandra/db/lifecycle/LifecycleTransaction.java
index 9b52269..59cee50 100644
--- a/src/java/org/apache/cassandra/db/lifecycle/LifecycleTransaction.java
+++ b/src/java/org/apache/cassandra/db/lifecycle/LifecycleTransaction.java
@@ -181,7 +181,10 @@ public class LifecycleTransaction extends Transactional.AbstractTransactional
         accumulate = markObsolete(null, obsolete, accumulate);
 
         // replace all updated readers with a version restored to its original state
-        accumulate = tracker.apply(updateLiveSet(logged.update, restoreUpdatedOriginals()),
accumulate);
+        List<SSTableReader> restored = restoreUpdatedOriginals();
+        List<SSTableReader> invalid = Lists.newArrayList(Iterables.concat(logged.update,
logged.obsolete));
+        accumulate = tracker.apply(updateLiveSet(logged.update, restored), accumulate);
+        accumulate = tracker.notifySSTablesChanged(invalid, restored, OperationType.COMPACTION,
accumulate);
         // setReplaced immediately preceding versions that have not been obsoleted
         accumulate = setReplaced(logged.update, accumulate);
         // we have replaced all of logged.update and never made visible staged.update,

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aefea62a/test/unit/org/apache/cassandra/io/sstable/SSTableRewriterTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/io/sstable/SSTableRewriterTest.java b/test/unit/org/apache/cassandra/io/sstable/SSTableRewriterTest.java
index 07820fd..c2cc6e3 100644
--- a/test/unit/org/apache/cassandra/io/sstable/SSTableRewriterTest.java
+++ b/test/unit/org/apache/cassandra/io/sstable/SSTableRewriterTest.java
@@ -41,6 +41,7 @@ import org.apache.cassandra.db.*;
 import org.apache.cassandra.db.compaction.AbstractCompactedRow;
 import org.apache.cassandra.db.compaction.AbstractCompactionStrategy;
 import org.apache.cassandra.db.compaction.CompactionController;
+import org.apache.cassandra.db.compaction.CompactionManager;
 import org.apache.cassandra.db.compaction.LazilyCompactedRow;
 import org.apache.cassandra.db.compaction.OperationType;
 import org.apache.cassandra.exceptions.ConfigurationException;
@@ -929,6 +930,8 @@ public class SSTableRewriterTest extends SchemaLoader
         assertEquals(spaceUsed, cfs.metric.liveDiskSpaceUsed.getCount());
         assertEquals(spaceUsed, cfs.metric.totalDiskSpaceUsed.getCount());
         assertTrue(cfs.getTracker().getCompacting().isEmpty());
+        if (cfs.getSSTables().size() > 0)
+            assertFalse(CompactionManager.instance.submitMaximal(cfs, cfs.gcBefore(System.currentTimeMillis()/1000),
false).isEmpty());
     }
 
     public static int assertFileCounts(String [] files, int expectedtmplinkCount, int expectedtmpCount)


Mime
View raw message