cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r988373 - in /cassandra/branches/cassandra-0.6: CHANGES.txt src/java/org/apache/cassandra/config/DatabaseDescriptor.java src/java/org/apache/cassandra/streaming/StreamInitiateVerbHandler.java
Date Tue, 24 Aug 2010 02:06:20 GMT
Author: jbellis
Date: Tue Aug 24 02:06:20 2010
New Revision: 988373

URL: http://svn.apache.org/viewvc?rev=988373&view=rev
Log:
fix streaming for keyspaces with hyphens in their name.  patch by Eric Onnen; reviewed by
jbellis for CASSANDRA-1377

Modified:
    cassandra/branches/cassandra-0.6/CHANGES.txt
    cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
    cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/streaming/StreamInitiateVerbHandler.java

Modified: cassandra/branches/cassandra-0.6/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/CHANGES.txt?rev=988373&r1=988372&r2=988373&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.6/CHANGES.txt Tue Aug 24 02:06:20 2010
@@ -7,8 +7,7 @@
  * remove String.trim() call on row keys in batch mutations (CASSANDRA-1235)
  * Log summary of dropped messages instead of spamming log (CASSANDRA-1284)
  * Dynamic snitch (CASSANDRA-981)
- * Use a regex to filter keyspace and column family names during
-   initialization (CASSANDRA-1377)
+ * fix streaming for keyspaces with hyphens in their name (CASSANDRA-1377)
  * fix errors in hard-coded bloom filter optKPerBucket by computing it
    algorithmically (CASSANDRA-1220
  * remove message deserialization stage, and uncap read/write stages

Modified: cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/config/DatabaseDescriptor.java?rev=988373&r1=988372&r2=988373&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
(original)
+++ cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
Tue Aug 24 02:06:20 2010
@@ -588,8 +588,6 @@ public class DatabaseDescriptor
                 {
                     throw new ConfigurationException("'system' is a reserved table name for
Cassandra internals");
                 }
-                if (!ksName.matches("\\w+"))
-                    throw new ConfigurationException("keyspace name contains invalid char");
 
                 /* See which replica placement strategy to use */
                 String replicaPlacementStrategyClassName = xmlUtils.getNodeValue("/Storage/Keyspaces/Keyspace[@Name='"
+ ksName + "']/ReplicaPlacementStrategy");
@@ -671,10 +669,6 @@ public class DatabaseDescriptor
                     {
                         throw new ConfigurationException("ColumnFamily name attribute is
required");
                     }
-                    if (!cfName.matches("\\w+"))
-                    {
-                        throw new ConfigurationException("ColumnFamily name contains invalid
characters.");
-                    }
                     String xqlCF = xqlTable + "ColumnFamily[@Name='" + cfName + "']/";
 
                     // Parse out the column type

Modified: cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/streaming/StreamInitiateVerbHandler.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/streaming/StreamInitiateVerbHandler.java?rev=988373&r1=988372&r2=988373&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/streaming/StreamInitiateVerbHandler.java
(original)
+++ cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/streaming/StreamInitiateVerbHandler.java
Tue Aug 24 02:06:20 2010
@@ -28,6 +28,7 @@ import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
 
 import org.apache.cassandra.config.DatabaseDescriptor;
@@ -145,10 +146,17 @@ public class StreamInitiateVerbHandler i
         {
             String tableName;
             String[] pieces = FBUtilities.strip(distinctEntry, "-");
-            tableName = pieces[0];
+
+            if(pieces.length > 2) {
+                tableName = StringUtils.join(pieces, "-", 0, pieces.length -2);
+            }
+            else {
+                tableName = pieces[0];
+            }
+
             Table table = Table.open( tableName );
 
-            ColumnFamilyStore cfStore = table.getColumnFamilyStore(pieces[1]);
+            ColumnFamilyStore cfStore = table.getColumnFamilyStore(pieces[pieces.length -2]);
             if (logger.isDebugEnabled())
               logger.debug("Generating file name for " + distinctEntry + " ...");
             fileNames.put(distinctEntry, cfStore.getTempSSTableFileName());



Mime
View raw message