cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1130183 - in /cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra: config/CFMetaData.java db/ColumnFamilyStore.java thrift/ThriftValidation.java
Date Wed, 01 Jun 2011 15:11:28 GMT
Author: jbellis
Date: Wed Jun  1 15:11:28 2011
New Revision: 1130183

URL: http://svn.apache.org/viewvc?rev=1130183&view=rev
Log:
rename and improve comments for CFMD.indexColumnFamilyName

Modified:
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/config/CFMetaData.java
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/thrift/ThriftValidation.java

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/config/CFMetaData.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/config/CFMetaData.java?rev=1130183&r1=1130182&r2=1130183&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/config/CFMetaData.java
(original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/config/CFMetaData.java
Wed Jun  1 15:11:28 2011
@@ -257,7 +257,7 @@ public final class CFMetaData
 
     public static CFMetaData newIndexMetadata(CFMetaData parent, ColumnDefinition info, AbstractType
columnComparator)
     {
-        return new CFMetaData(parent.ksName, parent.indexName(info), ColumnFamilyType.Standard,
columnComparator, null)
+        return new CFMetaData(parent.ksName, parent.indexColumnFamilyName(info), ColumnFamilyType.Standard,
columnComparator, null)
                              .keyCacheSize(0.0)
                              .readRepairChance(0.0)
                              .gcGraceSeconds(parent.gcGraceSeconds)
@@ -305,11 +305,13 @@ public final class CFMetaData
         cfIdMap.remove(new Pair<String, String>(cfm.ksName, cfm.cfName));
     }
     
-    /** convention for nameing secondary indexes. */
-    public String indexName(ColumnDefinition info)
+    /**
+     * generate a column family name for an index corresponding to the given column.
+     * This is NOT the same as the index's name! This is only used in sstable filenames and
is not exposed to users.
+     */
+    public String indexColumnFamilyName(ColumnDefinition info)
     {
-        // what we should have done:
-        // return cfName + "." + (info.getIndexName() == null ? comparator.getString(info.name)
+ "_idx" : info.getIndexName());
+        // TODO simplify this when info.index_name is guaranteed to be set
         return cfName + "." + (info.getIndexName() == null ? ByteBufferUtil.bytesToHex(info.name)
: info.getIndexName());
     }
 

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/ColumnFamilyStore.java?rev=1130183&r1=1130182&r2=1130183&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
(original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
Wed Jun  1 15:11:28 2011
@@ -511,7 +511,7 @@ public class ColumnFamilyStore implement
         if (cfm != null) // secondary indexes aren't stored in DD.
         {
             for (ColumnDefinition def : cfm.getColumn_metadata().values())
-                scrubDataDirectories(table, cfm.indexName(def));
+                scrubDataDirectories(table, cfm.indexColumnFamilyName(def));
         }
     }
 

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/thrift/ThriftValidation.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/thrift/ThriftValidation.java?rev=1130183&r1=1130182&r2=1130183&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/thrift/ThriftValidation.java
(original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/thrift/ThriftValidation.java
Wed Jun  1 15:11:28 2011
@@ -555,7 +555,7 @@ public class ThriftValidation
             {
                 // Ensure that given idx_names and auto_generated idx_names cannot collide
                 CFMetaData cfm = CFMetaData.fromThrift(cf_def);
-                String idxName = cfm.indexName(ColumnDefinition.fromColumnDef(c));
+                String idxName = cfm.indexColumnFamilyName(ColumnDefinition.fromColumnDef(c));
                 if (indexNames.contains(idxName))
                     throw new InvalidRequestException("Duplicate index names " + idxName);
                 indexNames.add(idxName);



Mime
View raw message