src/java/org/apache/cassandra/config/DatabaseDescriptor.java
/** load keyspace (table) definitions, but do not initialize the table instances. */
load keyspace (table) definitions, but do not initialize the table instances.
load keyspace ( table ) definitions but do not initialize the table instances .
public static void loadSchemas() throws IOException
    {
        UUID uuid = Migration.getLastMigrationId();
        if (uuid == null)
        {
            logger.info("Couldn't detect any schema definitions in local storage.");
            boolean hasExistingTables = false;
            for (String dataDir : getAllDataFileLocations())
            {
                File dataPath = new File(dataDir);
                if (dataPath.exists() && dataPath.isDirectory())
                {
                    int dirCount = dataPath.listFiles(new FileFilter()
                    {
                        @Override
                        public boolean accept(File pathname)
                        {
                            return pathname.isDirectory();
                        }
                    }).length;
                    if (dirCount > 0)
                        hasExistingTables = true;
                }
                if (hasExistingTables)
                {
                    break;
                }
            }
            if (hasExistingTables)
                logger.info("Found table data in data directories. Consider using the CLI to define your schema.");
            else
                logger.info("To create keyspaces and column families, see 'help create keyspace' in the CLI, or set up a schema using the thrift system_* calls.");
        }
        else
        {
            logger.info("Loading schema version " + uuid.toString());
            Collection<KSMetaData> tableDefs = DefsTable.loadFromStorage(uuid);
            if (tableDefs.size() == 0)
            {
                logger.warn("No schema definitions were found in local storage.");
                Schema.instance.setVersion(uuid);
            }
            else 
            {
                Schema.instance.load(tableDefs, uuid);
            }
        }
        Schema.instance.fixCFMaxId();
    }
public static void loadSchemas ( ) throws IOException { UUID uuid = Migration . getLastMigrationId ( ) ; if ( uuid == null ) { logger . info ( "Couldn't detect any schema definitions in local storage." ) ; boolean hasExistingTables = false ; for ( String dataDir : getAllDataFileLocations ( ) ) { File dataPath = new File ( dataDir ) ; if ( dataPath . exists ( ) && dataPath . isDirectory ( ) ) { int dirCount = dataPath . listFiles ( new FileFilter ( ) { @ Override public boolean accept ( File pathname ) { return pathname . isDirectory ( ) ; } } ) . length ; if ( dirCount > 0 ) hasExistingTables = true ; } if ( hasExistingTables ) { break ; } } if ( hasExistingTables ) logger . info ( "Found table data in data directories. Consider using the CLI to define your schema." ) ; else logger . info ( "To create keyspaces and column families, see 'help create keyspace' in the CLI, or set up a schema using the thrift system_* calls." ) ; } else { logger . info ( "Loading schema version " + uuid . toString ( ) ) ; Collection < KSMetaData > tableDefs = DefsTable . loadFromStorage ( uuid ) ; if ( tableDefs . size ( ) == 0 ) { logger . warn ( "No schema definitions were found in local storage." ) ; Schema . instance . setVersion ( uuid ) ; } else { Schema . instance . load ( tableDefs , uuid ) ; } } Schema . instance . fixCFMaxId ( ) ; }
load keyspace (table) definitions, but do not initialize the table instances.
load keyspace ( table ) definitions but do not initialize the table instances .
// we can load tables from local storage if a version is set in the system table and that acutally maps to // real data in the definitions table.  If we do end up loading from xml, store the defintions so that we // don't load from xml anymore. // peek around the data directories to see if anything is there. // see if there are other directories present. // happens when someone manually deletes all tables and restarts. // set version so that migrations leading up to emptiness aren't replayed. // if non-system tables where found, trying to load them