cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdusba...@apache.org
Subject svn commit: r921959 - in /incubator/cassandra/trunk/src/java/org/apache/cassandra/config: CFMetaData.java DatabaseDescriptor.java
Date Thu, 11 Mar 2010 17:52:07 GMT
Author: gdusbabek
Date: Thu Mar 11 17:52:07 2010
New Revision: 921959

URL: http://svn.apache.org/viewvc?rev=921959&view=rev
Log:
establish ordering of cfids. Patch by Gary Dusbabek, reviewed by Jonthan Ellis.

Modified:
    incubator/cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java?rev=921959&r1=921958&r2=921959&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java Thu Mar
11 17:52:07 2010
@@ -54,7 +54,8 @@ public final class CFMetaData
     // this gets called after initialization to make sure that id generation happens properly.
     public static final void fixMaxId()
     {
-        idGen.set(Collections.max(cfIdMap.values()) + 1);
+        // never set it to less than 1000. this ensures that we have enough system CFids
for future use.
+        idGen.set(Math.max(Collections.max(cfIdMap.values()) + 1, 1000));
     }
     
     public final String tableName;            // name of table which has this column family

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java?rev=921959&r1=921958&r2=921959&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
(original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
Thu Mar 11 17:52:07 2010
@@ -455,10 +455,6 @@ public class DatabaseDescriptor
             if ( value != null)
                 CommitLog.setSegmentSize(Integer.parseInt(value) * 1024 * 1024);
 
-            readTablesFromXml();
-            if (tables.isEmpty())
-                throw new ConfigurationException("No keyspaces configured");
- 
             // Hardcoded system tables
             final CFMetaData[] systemCfDefs = new CFMetaData[]
             {
@@ -490,7 +486,15 @@ public class DatabaseDescriptor
             };
             KSMetaData ksDefs = new KSMetaData(Table.DEFINITIONS, null, -1, null, definitionCfDefs);
             tables.put(Table.DEFINITIONS, ksDefs);
-
+            
+            // NOTE: make sure that all system CFMs defined by now. calling fixMaxId at this
point will set the base id
+            // to a value that leaves room for future system cfms.
+            CFMetaData.fixMaxId();
+            
+            // todo: if tables are defined in the system store, use those.  load from xml
otherwise.
+            readTablesFromXml();
+            CFMetaData.fixMaxId();
+            
             /* Load the seeds for node contact points */
             String[] seedsxml = xmlUtils.getNodeValues("/Storage/Seeds/Seed");
             if (seedsxml.length <= 0)
@@ -704,7 +708,6 @@ public class DatabaseDescriptor
             ex.initCause(e);
             throw ex;
         }
-        CFMetaData.fixMaxId();
     }
 
     public static IAuthenticator getAuthenticator()



Mime
View raw message