cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xe...@apache.org
Subject git commit: Remove system tables accounting from schema patch by Pavel Yaskevich; reviewed by Jonathan Ellis for CASSANDRA-4850
Date Wed, 31 Oct 2012 04:55:27 GMT
Updated Branches:
  refs/heads/trunk 3b0aa84ca -> da3ab363b


Remove system tables accounting from schema
patch by Pavel Yaskevich; reviewed by Jonathan Ellis for CASSANDRA-4850


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

Branch: refs/heads/trunk
Commit: da3ab363b0bb1f7375e4bc4a5d1cd7cc41c0a4e6
Parents: 3b0aa84
Author: Pavel Yaskevich <pyaskevich@twitter.com>
Authored: Tue Oct 30 11:28:58 2012 -0700
Committer: Pavel Yaskevich <pyaskevich@twitter.com>
Committed: Tue Oct 30 21:54:12 2012 -0700

----------------------------------------------------------------------
 CHANGES.txt                                       |    1 +
 src/java/org/apache/cassandra/config/Schema.java  |   21 +++++++++++++-
 src/java/org/apache/cassandra/db/DefsTable.java   |   23 ++-------------
 src/java/org/apache/cassandra/db/SystemTable.java |    3 ++
 4 files changed, 27 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/da3ab363/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 9c09742..12cc92a 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -42,6 +42,7 @@
  * Allow renaming PK columns in CQL3 (CASSANDRA-4822)
  * Fix binary protocol NEW_NODE event (CASSANDRA-4679)
  * Fix potential infinite loop in tombstone compaction (CASSANDRA-4781)
+ * Remove system tables accounting from schema (CASSANDRA-4850)
 Merged from 1.1:
  * add get[Row|Key]CacheEntries to CacheServiceMBean (CASSANDRA-4859)
  * fix get_paged_slice to wrap to next row correctly (CASSANDRA-4816)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/da3ab363/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 de89140..c3e90be 100644
--- a/src/java/org/apache/cassandra/config/Schema.java
+++ b/src/java/org/apache/cassandra/config/Schema.java
@@ -18,11 +18,13 @@
 package org.apache.cassandra.config;
 
 import java.nio.ByteBuffer;
+import java.nio.charset.CharacterCodingException;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.util.*;
 
 import com.google.common.collect.*;
+import org.apache.cassandra.utils.ByteBufferUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -431,7 +433,7 @@ public class Schema
 
             for (Row row : SystemTable.serializedSchema())
             {
-                if (row.cf == null || (row.cf.isMarkedForDelete() && row.cf.isEmpty()))
+                if (invalidSchemaRow(row) || ignoredSchemaRow(row))
                     continue;
 
                 row.cf.updateDigest(versionDigest);
@@ -469,4 +471,21 @@ public class Schema
 
         updateVersionAndAnnounce();
     }
+
+    public static boolean invalidSchemaRow(Row row)
+    {
+        return row.cf == null || (row.cf.isMarkedForDelete() && row.cf.isEmpty());
+    }
+
+    public static boolean ignoredSchemaRow(Row row)
+    {
+        try
+        {
+            return systemKeyspaceNames.contains(ByteBufferUtil.string(row.key.key));
+        }
+        catch (CharacterCodingException e)
+        {
+            throw new RuntimeException(e);
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/da3ab363/src/java/org/apache/cassandra/db/DefsTable.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/DefsTable.java b/src/java/org/apache/cassandra/db/DefsTable.java
index a012168..f1b2b4f 100644
--- a/src/java/org/apache/cassandra/db/DefsTable.java
+++ b/src/java/org/apache/cassandra/db/DefsTable.java
@@ -151,7 +151,7 @@ public class DefsTable
 
         for (Row row : serializedSchema)
         {
-            if (invalidSchemaRow(row) || ignoredSchemaRow(row))
+            if (Schema.invalidSchemaRow(row) || Schema.ignoredSchemaRow(row))
                 continue;
 
             keyspaces.add(KSMetaData.fromSchema(row, serializedColumnFamilies(row.key)));
@@ -179,7 +179,7 @@ public class DefsTable
         row_check_loop:
         for (Row row : rows)
         {
-            if (invalidSchemaRow(row))
+            if (Schema.invalidSchemaRow(row))
                 continue;
 
             for (IColumn column : row.cf.columns)
@@ -214,7 +214,7 @@ public class DefsTable
 
         for (Row row : rows)
         {
-            if (invalidSchemaRow(row))
+            if (Schema.invalidSchemaRow(row))
                 continue;
 
             RowMutation mutation = new RowMutation(Table.SYSTEM_KS, row.key.key);
@@ -229,23 +229,6 @@ public class DefsTable
         }
     }
 
-    private static boolean invalidSchemaRow(Row row)
-    {
-        return row.cf == null || (row.cf.isMarkedForDelete() && row.cf.isEmpty());
-    }
-
-    private static boolean ignoredSchemaRow(Row row)
-    {
-        try
-        {
-            return Schema.systemKeyspaceNames.contains(ByteBufferUtil.string(row.key.key));
-        }
-        catch (CharacterCodingException e)
-        {
-            throw new RuntimeException(e);
-        }
-    }
-
     public static ByteBuffer searchComposite(String name, boolean start)
     {
         assert name != null;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/da3ab363/src/java/org/apache/cassandra/db/SystemTable.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/SystemTable.java b/src/java/org/apache/cassandra/db/SystemTable.java
index e21e266..88825a7 100644
--- a/src/java/org/apache/cassandra/db/SystemTable.java
+++ b/src/java/org/apache/cassandra/db/SystemTable.java
@@ -590,6 +590,9 @@ public class SystemTable
     {
         for (Row schemaRow : serializedSchema(schemaCfName))
         {
+            if (Schema.ignoredSchemaRow(schemaRow))
+                continue;
+
             RowMutation mutation = mutationMap.get(schemaRow.key);
 
             if (mutation == null)


Mime
View raw message