src/java/org/apache/cassandra/db/DefsTable.java
/** dumps current keyspace definitions to storage */
dumps current keyspace definitions to storage
dumps current keyspace definitions to storage
public static synchronized void dumpToStorage(UUID version) throws IOException
    {
        final ByteBuffer versionKey = Migration.toUTF8Bytes(version);
        Collection<String> ksnames = org.apache.cassandra.config.Schema.instance.getNonSystemTables();
        RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, versionKey);
        long now = System.currentTimeMillis();
        for (String ksname : ksnames)
        {
            KSMetaData ksm = org.apache.cassandra.config.Schema.instance.getTableDefinition(ksname);
            rm.add(new QueryPath(Migration.SCHEMA_CF, null, ByteBufferUtil.bytes(ksm.name)), SerDeUtils.serialize(ksm.toAvro()), now);
        }
        rm.add(new QueryPath(Migration.SCHEMA_CF,
                             null,
                             DEFINITION_SCHEMA_COLUMN_NAME),
                             ByteBufferUtil.bytes(org.apache.cassandra.db.migration.avro.KsDef.SCHEMA$.toString()),
                             now);
        rm.apply();
        rm = new RowMutation(Table.SYSTEM_TABLE, Migration.LAST_MIGRATION_KEY);
        rm.add(new QueryPath(Migration.SCHEMA_CF, null, Migration.LAST_MIGRATION_KEY),
               ByteBuffer.wrap(UUIDGen.decompose(version)),
               now);
        rm.apply();
    }
public static synchronized void dumpToStorage ( UUID version ) throws IOException { final ByteBuffer versionKey = Migration . toUTF8Bytes ( version ) ; Collection < String > ksnames = org . apache . cassandra . config . Schema . instance . getNonSystemTables ( ) ; RowMutation rm = new RowMutation ( Table . SYSTEM_TABLE , versionKey ) ; long now = System . currentTimeMillis ( ) ; for ( String ksname : ksnames ) { KSMetaData ksm = org . apache . cassandra . config . Schema . instance . getTableDefinition ( ksname ) ; rm . add ( new QueryPath ( Migration . SCHEMA_CF , null , ByteBufferUtil . bytes ( ksm . name ) ) , SerDeUtils . serialize ( ksm . toAvro ( ) ) , now ) ; } rm . add ( new QueryPath ( Migration . SCHEMA_CF , null , DEFINITION_SCHEMA_COLUMN_NAME ) , ByteBufferUtil . bytes ( org . apache . cassandra . db . migration . avro . KsDef . SCHEMA$ . toString ( ) ) , now ) ; rm . apply ( ) ; rm = new RowMutation ( Table . SYSTEM_TABLE , Migration . LAST_MIGRATION_KEY ) ; rm . add ( new QueryPath ( Migration . SCHEMA_CF , null , Migration . LAST_MIGRATION_KEY ) , ByteBuffer . wrap ( UUIDGen . decompose ( version ) ) , now ) ; rm . apply ( ) ; }
dumps current keyspace definitions to storage
dumps current keyspace definitions to storage
// build a list of keyspaces // persist keyspaces under new version // add the schema // apply new version