cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marc...@apache.org
Subject git commit: Dont notify when replacing tmplink-files
Date Tue, 21 Oct 2014 15:58:55 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 18cd3e320 -> 3261d5e66


Dont notify when replacing tmplink-files

Patch by marcuse; reviewed by yukim for CASSANDRA-8157


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

Branch: refs/heads/cassandra-2.1
Commit: 3261d5e668f341464fc322b6bc424b33ce3adffd
Parents: 18cd3e3
Author: Marcus Eriksson <marcuse@apache.org>
Authored: Tue Oct 21 15:46:05 2014 +0200
Committer: Marcus Eriksson <marcuse@apache.org>
Committed: Tue Oct 21 17:57:32 2014 +0200

----------------------------------------------------------------------
 CHANGES.txt                                       |  1 +
 src/java/org/apache/cassandra/db/DataTracker.java |  4 ++--
 .../cassandra/io/sstable/IndexSummaryManager.java |  2 +-
 .../cassandra/io/sstable/SSTableRewriter.java     | 18 +++++++++---------
 .../io/sstable/IndexSummaryManagerTest.java       |  2 +-
 .../cassandra/io/sstable/SSTableReaderTest.java   |  2 +-
 6 files changed, 15 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/3261d5e6/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 09ab91b..96a5e23 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.1.1
+ * Dont notify when replacing tmplink files (CASSANDRA-8157)
  * Fix validation with multiple CONTAINS clause (CASSANDRA-8131)
  * Fix validation of collections in TriggerExecutor (CASSANDRA-8146)
  * Fix IllegalArgumentException when a list of IN values containing tuples

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3261d5e6/src/java/org/apache/cassandra/db/DataTracker.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/DataTracker.java b/src/java/org/apache/cassandra/db/DataTracker.java
index 2ff040c..7393323 100644
--- a/src/java/org/apache/cassandra/db/DataTracker.java
+++ b/src/java/org/apache/cassandra/db/DataTracker.java
@@ -358,7 +358,7 @@ public class DataTracker
      * @param oldSSTables replaced readers
      * @param newSSTables replacement readers
      */
-    public void replaceReaders(Collection<SSTableReader> oldSSTables, Collection<SSTableReader>
newSSTables)
+    public void replaceReaders(Collection<SSTableReader> oldSSTables, Collection<SSTableReader>
newSSTables, boolean notify)
     {
         View currentView, newView;
         do
@@ -368,7 +368,7 @@ public class DataTracker
         }
         while (!view.compareAndSet(currentView, newView));
 
-        if (!oldSSTables.isEmpty())
+        if (!oldSSTables.isEmpty() && notify)
             notifySSTablesChanged(oldSSTables, newSSTables, OperationType.COMPACTION);
 
         for (SSTableReader sstable : newSSTables)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3261d5e6/src/java/org/apache/cassandra/io/sstable/IndexSummaryManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/IndexSummaryManager.java b/src/java/org/apache/cassandra/io/sstable/IndexSummaryManager.java
index d5b7364..e39d75d 100644
--- a/src/java/org/apache/cassandra/io/sstable/IndexSummaryManager.java
+++ b/src/java/org/apache/cassandra/io/sstable/IndexSummaryManager.java
@@ -426,7 +426,7 @@ public class IndexSummaryManager implements IndexSummaryManagerMBean
 
         for (DataTracker tracker : replacedByTracker.keySet())
         {
-            tracker.replaceReaders(replacedByTracker.get(tracker), replacementsByTracker.get(tracker));
+            tracker.replaceReaders(replacedByTracker.get(tracker), replacementsByTracker.get(tracker),
true);
             newSSTables.addAll(replacementsByTracker.get(tracker));
         }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3261d5e6/src/java/org/apache/cassandra/io/sstable/SSTableRewriter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/SSTableRewriter.java b/src/java/org/apache/cassandra/io/sstable/SSTableRewriter.java
index 4055b42..76677ac 100644
--- a/src/java/org/apache/cassandra/io/sstable/SSTableRewriter.java
+++ b/src/java/org/apache/cassandra/io/sstable/SSTableRewriter.java
@@ -174,7 +174,7 @@ public class SSTableRewriter
                 SSTableReader reader = writer.openEarly(maxAge);
                 if (reader != null)
                 {
-                    replaceReader(currentlyOpenedEarly, reader);
+                    replaceReader(currentlyOpenedEarly, reader, false);
                     currentlyOpenedEarly = reader;
                     currentlyOpenedEarlyAt = writer.getFilePointer();
                     moveStarts(reader, Functions.constant(reader.last), false);
@@ -197,7 +197,7 @@ public class SSTableRewriter
         // releases reference in replaceReaders
         if (!isOffline)
         {
-            dataTracker.replaceReaders(close, Collections.<SSTableReader>emptyList());
+            dataTracker.replaceReaders(close, Collections.<SSTableReader>emptyList(),
false);
             dataTracker.unmarkCompacting(close);
         }
         writer.abort(currentlyOpenedEarly == null);
@@ -247,12 +247,12 @@ public class SSTableRewriter
                 }));
             }
         }
-        replaceReaders(toReplace, replaceWith);
+        replaceReaders(toReplace, replaceWith, true);
         rewriting.removeAll(toReplace);
         rewriting.addAll(replaceWith);
     }
 
-    private void replaceReader(SSTableReader toReplace, SSTableReader replaceWith)
+    private void replaceReader(SSTableReader toReplace, SSTableReader replaceWith, boolean
notify)
     {
         if (isOffline)
             return;
@@ -267,14 +267,14 @@ public class SSTableRewriter
             dataTracker.markCompacting(Collections.singleton(replaceWith));
             toReplaceSet = Collections.emptySet();
         }
-        replaceReaders(toReplaceSet, Collections.singleton(replaceWith));
+        replaceReaders(toReplaceSet, Collections.singleton(replaceWith), notify);
     }
 
-    private void replaceReaders(Collection<SSTableReader> toReplace, Collection<SSTableReader>
replaceWith)
+    private void replaceReaders(Collection<SSTableReader> toReplace, Collection<SSTableReader>
replaceWith, boolean notify)
     {
         if (isOffline)
             return;
-        dataTracker.replaceReaders(toReplace, replaceWith);
+        dataTracker.replaceReaders(toReplace, replaceWith, notify);
     }
 
     public void switchWriter(SSTableWriter newWriter)
@@ -287,7 +287,7 @@ public class SSTableRewriter
         // tmp = false because later we want to query it with descriptor from SSTableReader
         SSTableReader reader = writer.closeAndOpenReader(maxAge);
         finished.add(reader);
-        replaceReader(currentlyOpenedEarly, reader);
+        replaceReader(currentlyOpenedEarly, reader, false);
         moveStarts(reader, Functions.constant(reader.last), false);
         currentlyOpenedEarly = null;
         currentlyOpenedEarlyAt = 0;
@@ -314,7 +314,7 @@ public class SSTableRewriter
                                     writer.closeAndOpenReader(maxAge) :
                                     writer.closeAndOpenReader(maxAge, repairedAt);
             finished.add(reader);
-            replaceReader(currentlyOpenedEarly, reader);
+            replaceReader(currentlyOpenedEarly, reader, false);
             moveStarts(reader, Functions.constant(reader.last), false);
         }
         else

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3261d5e6/test/unit/org/apache/cassandra/io/sstable/IndexSummaryManagerTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/io/sstable/IndexSummaryManagerTest.java b/test/unit/org/apache/cassandra/io/sstable/IndexSummaryManagerTest.java
index 5281449..b621c45 100644
--- a/test/unit/org/apache/cassandra/io/sstable/IndexSummaryManagerTest.java
+++ b/test/unit/org/apache/cassandra/io/sstable/IndexSummaryManagerTest.java
@@ -428,7 +428,7 @@ public class IndexSummaryManagerTest extends SchemaLoader
         }
 
         // don't leave replaced SSTRs around to break other tests
-        cfs.getDataTracker().replaceReaders(Collections.singleton(original), Collections.singleton(sstable));
+        cfs.getDataTracker().replaceReaders(Collections.singleton(original), Collections.singleton(sstable),
true);
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3261d5e6/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java b/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java
index 91f5341..7f85019 100644
--- a/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java
+++ b/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java
@@ -412,7 +412,7 @@ public class SSTableReaderTest extends SchemaLoader
         }
 
         SSTableReader replacement = sstable.cloneWithNewSummarySamplingLevel(store, 1);
-        store.getDataTracker().replaceReaders(Arrays.asList(sstable), Arrays.asList(replacement));
+        store.getDataTracker().replaceReaders(Arrays.asList(sstable), Arrays.asList(replacement),
true);
         for (Future future : futures)
             future.get();
 


Mime
View raw message