cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alek...@apache.org
Subject [1/2] cassandra git commit: Fix remaining dtest failures caused by CASSANDRA-8143
Date Tue, 04 Aug 2015 13:27:36 GMT
Repository: cassandra
Updated Branches:
  refs/heads/trunk 55a9b1b7f -> 630220a2a


Fix remaining dtest failures caused by CASSANDRA-8143

patch by Branimir Lambov; reviewed by Aleksey Yeschenko for
CASSANDRA-8143


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

Branch: refs/heads/trunk
Commit: 64e93a76d8065e2cadeffbc04d28c995dcc9bc0c
Parents: be0eebd
Author: Branimir Lambov <branimir.lambov@datastax.com>
Authored: Tue Aug 4 16:26:18 2015 +0300
Committer: Aleksey Yeschenko <aleksey@apache.org>
Committed: Tue Aug 4 16:26:18 2015 +0300

----------------------------------------------------------------------
 .../apache/cassandra/db/ColumnFamilyStore.java   |  6 ++----
 .../apache/cassandra/db/lifecycle/Helpers.java   | 14 ++------------
 .../db/lifecycle/LifecycleTransaction.java       |  2 +-
 .../apache/cassandra/db/lifecycle/Tracker.java   |  4 ++--
 .../cassandra/io/sstable/SSTableRewriter.java    |  2 +-
 .../io/sstable/format/SSTableReader.java         | 19 +++++++++++--------
 6 files changed, 19 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/64e93a76/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
index d77cf1f..1f3c7db 100644
--- a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
+++ b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
@@ -276,14 +276,12 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
         }
     }
 
+    // FIXME: this is wrong, JMX should never update live CFMetaData objects
     public void setCrcCheckChance(double crcCheckChance)
     {
         try
         {
-            // TODO: this doesn't affect sstables being written
-            for (SSTableReader sstable : keyspace.getAllSSTables(SSTableSet.CANONICAL))
-                if (sstable.compression)
-                    sstable.getCompressionMetadata().parameters.setCrcCheckChance(crcCheckChance);
+            metadata.params.compression.setCrcCheckChance(crcCheckChance);
         }
         catch (ConfigurationException e)
         {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/64e93a76/src/java/org/apache/cassandra/db/lifecycle/Helpers.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/lifecycle/Helpers.java b/src/java/org/apache/cassandra/db/lifecycle/Helpers.java
index 2b94d7a..8cb92b9 100644
--- a/src/java/org/apache/cassandra/db/lifecycle/Helpers.java
+++ b/src/java/org/apache/cassandra/db/lifecycle/Helpers.java
@@ -71,10 +71,10 @@ class Helpers
      * A convenience method for encapsulating this action over multiple SSTableReader with
exception-safety
      * @return accumulate if not null (with any thrown exception attached), or any thrown
exception otherwise
      */
-    static void setupKeyCache(Iterable<SSTableReader> readers)
+    static void setupOnline(Iterable<SSTableReader> readers)
     {
         for (SSTableReader reader : readers)
-            reader.setupKeyCache();
+            reader.setupOnline();
     }
 
     /**
@@ -98,16 +98,6 @@ class Helpers
     }
 
     /**
-     * A convenience method for encapsulating this action over multiple SSTableReader with
exception-safety
-     * @return accumulate if not null (with any thrown exception attached), or any thrown
exception otherwise
-     */
-    static void setupKeycache(Iterable<SSTableReader> readers)
-    {
-        for (SSTableReader reader : readers)
-            reader.setupKeyCache();
-    }
-
-    /**
      * assert that none of these readers have been replaced
      */
     static void checkNotReplaced(Iterable<SSTableReader> readers)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/64e93a76/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 edfd795..5d6d9f9 100644
--- a/src/java/org/apache/cassandra/db/lifecycle/LifecycleTransaction.java
+++ b/src/java/org/apache/cassandra/db/lifecycle/LifecycleTransaction.java
@@ -350,7 +350,7 @@ public class LifecycleTransaction extends Transactional.AbstractTransactional
         staged.update.add(reader);
         identities.add(reader.instanceId);
         if (!isOffline())
-            reader.setupKeyCache();
+            reader.setupOnline();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/cassandra/blob/64e93a76/src/java/org/apache/cassandra/db/lifecycle/Tracker.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/lifecycle/Tracker.java b/src/java/org/apache/cassandra/db/lifecycle/Tracker.java
index f5829ea..ea76fd6 100644
--- a/src/java/org/apache/cassandra/db/lifecycle/Tracker.java
+++ b/src/java/org/apache/cassandra/db/lifecycle/Tracker.java
@@ -177,7 +177,7 @@ public class Tracker
     public void addInitialSSTables(Iterable<SSTableReader> sstables)
     {
         if (!isDummy())
-            setupKeycache(sstables);
+            setupOnline(sstables);
         apply(updateLiveSet(emptySet(), sstables));
         maybeFail(updateSizeTracking(emptySet(), sstables, null));
         // no notifications or backup necessary
@@ -341,7 +341,7 @@ public class Tracker
             return;
         }
 
-        sstable.setupKeyCache();
+        sstable.setupOnline();
         // back up before creating a new Snapshot (which makes the new one eligible for compaction)
         maybeIncrementallyBackup(sstable);
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/64e93a76/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 4eebb0c..34a657f 100644
--- a/src/java/org/apache/cassandra/io/sstable/SSTableRewriter.java
+++ b/src/java/org/apache/cassandra/io/sstable/SSTableRewriter.java
@@ -222,7 +222,7 @@ public class SSTableRewriter extends Transactional.AbstractTransactional
impleme
 
         final List<DecoratedKey> invalidateKeys = new ArrayList<>();
         invalidateKeys.addAll(cachedKeys.keySet());
-        newReader.setupKeyCache();
+        newReader.setupOnline();
         for (Map.Entry<DecoratedKey, RowIndexEntry> cacheKey : cachedKeys.entrySet())
             newReader.cacheKey(cacheKey.getKey(), cacheKey.getValue());
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/64e93a76/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java b/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java
index f13fbba..d5c192e 100644
--- a/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java
+++ b/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java
@@ -635,12 +635,19 @@ public abstract class SSTableReader extends SSTable implements SelfRefCounted<SS
         return dfile.path();
     }
 
-    public void setupKeyCache()
+    public void setupOnline()
     {
         // under normal operation we can do this at any time, but SSTR is also used outside
C* proper,
         // e.g. by BulkLoader, which does not initialize the cache.  As a kludge, we set
up the cache
         // here when we know we're being wired into the rest of the server infrastructure.
         keyCache = CacheService.instance.keyCache;
+
+        // ensure secondary index compression metadata is linked to the parent metadata.
+        if (compression && metadata.isIndex())
+        {
+            getCompressionMetadata().parameters.setLiveMetadata(
+                    Schema.instance.getCFMetaData(metadata.ksName, metadata.getParentColumnFamilyName()));
+        }
     }
 
     public boolean isKeyCacheSetup()
@@ -1287,13 +1294,7 @@ public abstract class SSTableReader extends SSTable implements SelfRefCounted<SS
         if (!compression)
             throw new IllegalStateException(this + " is not compressed");
 
-        CompressionMetadata cmd = ((ICompressedFile) dfile).getMetadata();
-
-        // We need the parent cf metadata
-        String cfName = metadata.isIndex() ? metadata.getParentColumnFamilyName() : metadata.cfName;
-        cmd.parameters.setLiveMetadata(Schema.instance.getCFMetaData(metadata.ksName, cfName));
-
-        return cmd;
+        return ((ICompressedFile) dfile).getMetadata();
     }
 
     /**
@@ -2050,6 +2051,8 @@ public abstract class SSTableReader extends SSTable implements SelfRefCounted<SS
     {
         tidy.setup(this, trackHotness);
         this.readMeter = tidy.global.readMeter;
+        if (compression)
+            getCompressionMetadata().parameters.setLiveMetadata(metadata);
     }
 
     @VisibleForTesting


Mime
View raw message