cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alek...@apache.org
Subject cassandra git commit: Get rid of CFMetaData.isPurged
Date Mon, 13 Jul 2015 11:40:16 GMT
Repository: cassandra
Updated Branches:
  refs/heads/trunk 87ea6bc91 -> 5ba79cbf2


Get rid of CFMetaData.isPurged

patch by Aleksey Yeschenko; reviewed by Benedict Elliot
Smith for CASSANDRA-9780


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

Branch: refs/heads/trunk
Commit: 5ba79cbf208649d36ba04834fc8ef242638dee7e
Parents: 87ea6bc
Author: Aleksey Yeschenko <aleksey@apache.org>
Authored: Sun Jul 12 13:38:40 2015 +0300
Committer: Aleksey Yeschenko <aleksey@apache.org>
Committed: Mon Jul 13 14:37:39 2015 +0300

----------------------------------------------------------------------
 .../org/apache/cassandra/config/CFMetaData.java     | 13 +------------
 src/java/org/apache/cassandra/config/Schema.java    | 16 +++++-----------
 .../cassandra/db/commitlog/CommitLogSegment.java    |  9 +--------
 .../db/commitlog/CommitLogUpgradeTest.java          |  2 +-
 4 files changed, 8 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/5ba79cbf/src/java/org/apache/cassandra/config/CFMetaData.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/CFMetaData.java b/src/java/org/apache/cassandra/config/CFMetaData.java
index fea2638..8ae5e93 100644
--- a/src/java/org/apache/cassandra/config/CFMetaData.java
+++ b/src/java/org/apache/cassandra/config/CFMetaData.java
@@ -193,7 +193,7 @@ public final class CFMetaData
     private volatile SpeculativeRetry speculativeRetry = DEFAULT_SPECULATIVE_RETRY;
     private volatile Map<ColumnIdentifier, DroppedColumn> droppedColumns = new HashMap<>();
     private volatile Triggers triggers = Triggers.none();
-    private volatile boolean isPurged = false;
+
     /*
      * All CQL3 columns definition are stored in the columnMetadata map.
      * On top of that, we keep separated collection of each kind of definition, to
@@ -201,7 +201,6 @@ public final class CFMetaData
      * clustering key ones, those list are ordered by the "component index" of the
      * elements.
      */
-
     private volatile Map<ByteBuffer, ColumnDefinition> columnMetadata = new HashMap<>();
     private volatile List<ColumnDefinition> partitionKeyColumns;  // Always of size
keyValidator.componentsCount, null padded if necessary
     private volatile List<ColumnDefinition> clusteringColumns;    // Of size comparator.componentsCount
or comparator.componentsCount -1, null padded if necessary
@@ -1118,16 +1117,6 @@ public final class CFMetaData
                                                            "interval (%d).", maxIndexInterval,
minIndexInterval));
     }
 
-    public boolean isPurged()
-    {
-        return isPurged;
-    }
-
-    void markPurged()
-    {
-        isPurged = true;
-    }
-
     // The comparator to validate the definition name.
     public AbstractType<?> thriftColumnNameType()
     {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5ba79cbf/src/java/org/apache/cassandra/config/Schema.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/Schema.java b/src/java/org/apache/cassandra/config/Schema.java
index 29dffa1..c934327 100644
--- a/src/java/org/apache/cassandra/config/Schema.java
+++ b/src/java/org/apache/cassandra/config/Schema.java
@@ -357,20 +357,14 @@ public class Schema
         cfIdMap.put(key, cfm.cfId);
     }
 
-    public void unload(CFMetaData cfm)
-    {
-        cfIdMap.remove(Pair.create(cfm.ksName, cfm.cfName));
-    }
-
     /**
      * Used for ColumnFamily data eviction out from the schema
      *
      * @param cfm The ColumnFamily Definition to evict
      */
-    public void purge(CFMetaData cfm)
+    public void unload(CFMetaData cfm)
     {
-        unload(cfm);
-        cfm.markPurged();
+        cfIdMap.remove(Pair.create(cfm.ksName, cfm.cfName));
     }
 
     /* Function helpers */
@@ -449,7 +443,7 @@ public class Schema
         for (String keyspaceName : getNonSystemKeyspaces())
         {
             KeyspaceMetadata ksm = getKSMetaData(keyspaceName);
-            ksm.tables.forEach(this::purge);
+            ksm.tables.forEach(this::unload);
             clearKeyspaceMetadata(ksm);
         }
 
@@ -486,7 +480,7 @@ public class Schema
         {
             ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(cfm.cfName);
 
-            purge(cfm);
+            unload(cfm);
 
             if (DatabaseDescriptor.isAutoSnapshot())
                 cfs.snapshot(snapshotName);
@@ -551,7 +545,7 @@ public class Schema
         CFMetaData cfm = oldKsm.tables.get(tableName).get();
         KeyspaceMetadata newKsm = oldKsm.withSwapped(oldKsm.tables.without(tableName));
 
-        purge(cfm);
+        unload(cfm);
         setKeyspaceMetadata(newKsm);
 
         CompactionManager.instance.interruptCompactionFor(Collections.singleton(cfm), true);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5ba79cbf/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java b/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
index 41bb31e..b4b7b19 100644
--- a/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
+++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
@@ -401,14 +401,7 @@ public abstract class CommitLogSegment
     void markDirty(Mutation mutation, int allocatedPosition)
     {
         for (PartitionUpdate update : mutation.getPartitionUpdates())
-        {
-            // check for deleted CFS
-            CFMetaData cfm = update.metadata();
-            if (cfm.isPurged())
-                logger.error("Attempted to write commit log entry for unrecognized table:
{}", cfm.cfId);
-            else
-                ensureAtleast(cfDirty, cfm.cfId, allocatedPosition);
-        }
+            ensureAtleast(cfDirty, update.metadata().cfId, allocatedPosition);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5ba79cbf/test/unit/org/apache/cassandra/db/commitlog/CommitLogUpgradeTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/commitlog/CommitLogUpgradeTest.java b/test/unit/org/apache/cassandra/db/commitlog/CommitLogUpgradeTest.java
index 1289f43..3d13a22 100644
--- a/test/unit/org/apache/cassandra/db/commitlog/CommitLogUpgradeTest.java
+++ b/test/unit/org/apache/cassandra/db/commitlog/CommitLogUpgradeTest.java
@@ -87,7 +87,7 @@ public class CommitLogUpgradeTest
             if (Schema.instance.getCF(cfid) == null)
             {
                 CFMetaData cfm = Schema.instance.getCFMetaData(KEYSPACE, TABLE);
-                Schema.instance.purge(cfm);
+                Schema.instance.unload(cfm);
                 Schema.instance.load(cfm.copy(cfid));
             }
         }


Mime
View raw message