cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alek...@apache.org
Subject git commit: Expose CFMetaData#isDense()
Date Thu, 04 Sep 2014 18:46:26 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.0 aae9b9101 -> 77b036a87


Expose CFMetaData#isDense()


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

Branch: refs/heads/cassandra-2.0
Commit: 77b036a876d64d3cd12902d90db2f652e3e33d88
Parents: aae9b91
Author: Aleksey Yeschenko <aleksey@apache.org>
Authored: Thu Sep 4 14:45:59 2014 -0400
Committer: Aleksey Yeschenko <aleksey@apache.org>
Committed: Thu Sep 4 14:45:59 2014 -0400

----------------------------------------------------------------------
 .../org/apache/cassandra/config/CFMetaData.java    | 17 +++++++++++------
 .../cql3/statements/CreateTableStatement.java      |  2 +-
 2 files changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/77b036a8/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 fc8e8c3..e726957 100644
--- a/src/java/org/apache/cassandra/config/CFMetaData.java
+++ b/src/java/org/apache/cassandra/config/CFMetaData.java
@@ -452,7 +452,7 @@ public final class CFMetaData
     public CFMetaData populateIoCacheOnFlush(boolean prop) {populateIoCacheOnFlush = prop;
return this;}
     public CFMetaData droppedColumns(Map<ByteBuffer, Long> cols) {droppedColumns =
cols; return this;}
     public CFMetaData triggers(Map<String, TriggerDefinition> prop) {triggers = prop;
return this;}
-    public CFMetaData setDense(Boolean prop) {isDense = prop; return this;}
+    public CFMetaData isDense(Boolean prop) {isDense = prop; return this;}
 
     public CFMetaData(String keyspace, String name, ColumnFamilyType type, AbstractType<?>
comp, AbstractType<?> subcc)
     {
@@ -605,7 +605,7 @@ public final class CFMetaData
                       .populateIoCacheOnFlush(oldCFMD.populateIoCacheOnFlush)
                       .droppedColumns(new HashMap<>(oldCFMD.droppedColumns))
                       .triggers(new HashMap<>(oldCFMD.triggers))
-                      .setDense(oldCFMD.isDense)
+                      .isDense(oldCFMD.isDense)
                       .rebuild();
     }
 
@@ -786,6 +786,11 @@ public final class CFMetaData
         return droppedColumns;
     }
 
+    public Boolean getIsDense()
+    {
+        return isDense;
+    }
+
     public boolean equals(Object obj)
     {
         if (obj == this)
@@ -1117,7 +1122,7 @@ public final class CFMetaData
 
         triggers = cfm.triggers;
 
-        setDense(cfm.isDense);
+        isDense(cfm.isDense);
 
         rebuild();
         logger.debug("application result is {}", this);
@@ -1712,7 +1717,7 @@ public final class CFMetaData
                 cfm.populateIoCacheOnFlush(result.getBoolean("populate_io_cache_on_flush"));
 
             if (result.has("is_dense"))
-                cfm.setDense(result.getBoolean("is_dense"));
+                cfm.isDense(result.getBoolean("is_dense"));
 
             /*
              * The info previously hold by key_aliases, column_aliases and value_alias is
now stored in column_metadata (because 1) this
@@ -1964,7 +1969,7 @@ public final class CFMetaData
     {
         List<ColumnDefinition> pkCols = nullInitializedList(keyValidator.componentsCount());
         if (isDense == null)
-            setDense(isDense(comparator, column_metadata.values()));
+            isDense(calculateIsDense(comparator, column_metadata.values()));
         int nbCkCols = isDense
                      ? comparator.componentsCount()
                      : comparator.componentsCount() - (hasCollection() ? 2 : 1);
@@ -2087,7 +2092,7 @@ public final class CFMetaData
      * information for table just created through thrift, nor for table prior to CASSANDRA-7744,
so this
      * method does its best to infer whether the table is dense or not based on other elements.
      */
-    private static boolean isDense(AbstractType<?> comparator, Collection<ColumnDefinition>
defs)
+    private static boolean calculateIsDense(AbstractType<?> comparator, Collection<ColumnDefinition>
defs)
     {
         /*
          * As said above, this method is only here because we need to deal with thrift upgrades.

http://git-wip-us.apache.org/repos/asf/cassandra/blob/77b036a8/src/java/org/apache/cassandra/cql3/statements/CreateTableStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/statements/CreateTableStatement.java b/src/java/org/apache/cassandra/cql3/statements/CreateTableStatement.java
index b7f43d3..efaf36d 100644
--- a/src/java/org/apache/cassandra/cql3/statements/CreateTableStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/CreateTableStatement.java
@@ -158,7 +158,7 @@ public class CreateTableStatement extends SchemaAlteringStatement
         cfmd.defaultValidator(defaultValidator)
             .keyValidator(keyValidator)
             .columnMetadata(getColumns())
-            .setDense(isDense);
+            .isDense(isDense);
 
         cfmd.addColumnMetadataFromAliases(keyAliases, keyValidator, ColumnDefinition.Type.PARTITION_KEY);
         cfmd.addColumnMetadataFromAliases(columnAliases, comparator, ColumnDefinition.Type.CLUSTERING_KEY);


Mime
View raw message