private static void addColumnFamily(CFMetaData cfm) { assert Schema.instance.getCFMetaData(cfm.ksName, cfm.cfName) == null; KSMetaData ksm = Schema.instance.getKSMetaData(cfm.ksName); ksm = KSMetaData.cloneWith(ksm, Iterables.concat(ksm.cfMetaData().values(), Collections.singleton(cfm))); logger.info("Loading {}", cfm); Schema.instance.load(cfm); // make sure it's init-ed w/ the old definitions first, // since we're going to call initCf on the new one manually Keyspace.open(cfm.ksName); Schema.instance.setKeyspaceDefinition(ksm); if (!StorageService.instance.isClientMode()) { Keyspace.open(ksm.name).initCf(cfm.cfId, cfm.cfName, true); MigrationManager.instance.notifyCreateColumnFamily(cfm); } }
public void addTable(CFMetaData cfm) { assert getCFMetaData(cfm.ksName, cfm.cfName) == null; // Make sure the keyspace is initialized // and init the new CF before switching the KSM to the new one // to avoid races as in CASSANDRA-10761 Keyspace.open(cfm.ksName).initCf(cfm, true); // Update the keyspaces map with the updated metadata update(cfm.ksName, ks -> ks.withSwapped(ks.tables.with(cfm))); // Update the table ID <-> table name map (cfIdMap) load(cfm); MigrationManager.instance.notifyCreateColumnFamily(cfm); }
public void addTable(CFMetaData cfm) { assert getCFMetaData(cfm.ksName, cfm.cfName) == null; // Make sure the keyspace is initialized // and init the new CF before switching the KSM to the new one // to avoid races as in CASSANDRA-10761 Keyspace.open(cfm.ksName).initCf(cfm, true); // Update the keyspaces map with the updated metadata update(cfm.ksName, ks -> ks.withSwapped(ks.tables.with(cfm))); // Update the table ID <-> table name map (cfIdMap) load(cfm); MigrationManager.instance.notifyCreateColumnFamily(cfm); }
public void addTable(CFMetaData cfm) { assert getCFMetaData(cfm.ksName, cfm.cfName) == null; // Make sure the keyspace is initialized // and init the new CF before switching the KSM to the new one // to avoid races as in CASSANDRA-10761 Keyspace keyspace = Keyspace.open(cfm.ksName); keyspace.initCf(cfm, true); // Update the keyspaces map with the updated metadata update(cfm.ksName, ks -> ks.withSwapped(ks.tables.with(cfm))); // Update the table ID <-> table name map (cfIdMap) load(cfm); MigrationManager.instance.notifyCreateColumnFamily(keyspace.getMetadata(), cfm); }