org.apache.cassandra.service.MigrationManager Java Examples

The following examples show how to use org.apache.cassandra.service.MigrationManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CassandraServer.java    From stratio-cassandra with Apache License 2.0 6 votes vote down vote up
public String system_add_column_family(CfDef cf_def)
throws InvalidRequestException, SchemaDisagreementException, TException
{
    logger.debug("add_column_family");

    try
    {
        ClientState cState = state();
        String keyspace = cState.getKeyspace();
        cState.hasKeyspaceAccess(keyspace, Permission.CREATE);
        cf_def.unsetId(); // explicitly ignore any id set by client (Hector likes to set zero)
        CFMetaData cfm = CFMetaData.fromThrift(cf_def);
        CFMetaData.validateCompactionOptions(cfm.compactionStrategyClass, cfm.compactionStrategyOptions);
        cfm.addDefaultIndexNames();

        if (!cfm.getTriggers().isEmpty())
            state().ensureIsSuper("Only superusers are allowed to add triggers.");

        MigrationManager.announceNewColumnFamily(cfm);
        return Schema.instance.getVersion().toString();
    }
    catch (RequestValidationException e)
    {
        throw ThriftConversion.toThrift(e);
    }
}
 
Example #2
Source File: CassandraRunner.java    From staash with Apache License 2.0 6 votes vote down vote up
private void maybeCreateKeyspace(RequiresKeyspace rk, RequiresColumnFamily rcf) {
  logger.debug("RequiresKeyspace annotation has keyspace name: {}", rk.ksName());
  List<CFMetaData> cfs = extractColumnFamily(rcf);
  try {
    MigrationManager
            .announceNewKeyspace(KSMetaData.newKeyspace(rk.ksName(),
                    rk.strategy(), KSMetaData.optsWithRF(rk.replication()), false, cfs));
  } catch (AlreadyExistsException aee) {
    logger.info("using existing Keyspace for " + rk.ksName());
    if ( cfs.size() > 0 ) {
      maybeTruncateSafely(rcf);
    }
  } catch (Exception ex) {
    throw new RuntimeException("Failure creating keyspace for " + rk.ksName(),ex);
  }
}
 
Example #3
Source File: TriggersSchemaTest.java    From stratio-cassandra with Apache License 2.0 6 votes vote down vote up
@Test
public void removeTriggerFromCf() throws Exception
{
    TriggerDefinition td = TriggerDefinition.create(triggerName, triggerClass);
    CFMetaData cfm1 = CFMetaData.compile(String.format("CREATE TABLE %s (k int PRIMARY KEY, v int)", cfName), ksName);
    cfm1.addTriggerDefinition(td);
    KSMetaData ksm = KSMetaData.newKeyspace(ksName,
                                            SimpleStrategy.class,
                                            Collections.singletonMap("replication_factor", "1"),
                                            true,
                                            Collections.singletonList(cfm1));
    MigrationManager.announceNewKeyspace(ksm);

    CFMetaData cfm2 = Schema.instance.getCFMetaData(ksName, cfName).copy();
    cfm2.removeTrigger(triggerName);
    MigrationManager.announceColumnFamilyUpdate(cfm2, false);

    CFMetaData cfm3 = Schema.instance.getCFMetaData(ksName, cfName).copy();
    assertTrue(cfm3.getTriggers().isEmpty());
}
 
Example #4
Source File: TriggersSchemaTest.java    From stratio-cassandra with Apache License 2.0 6 votes vote down vote up
@Test
public void addTriggerToCf() throws Exception
{
    CFMetaData cfm1 = CFMetaData.compile(String.format("CREATE TABLE %s (k int PRIMARY KEY, v int)", cfName), ksName);
    KSMetaData ksm = KSMetaData.newKeyspace(ksName,
                                            SimpleStrategy.class,
                                            Collections.singletonMap("replication_factor", "1"),
                                            true,
                                            Collections.singletonList(cfm1));
    MigrationManager.announceNewKeyspace(ksm);

    CFMetaData cfm2 = Schema.instance.getCFMetaData(ksName, cfName).copy();
    TriggerDefinition td = TriggerDefinition.create(triggerName, triggerClass);
    cfm2.addTriggerDefinition(td);
    MigrationManager.announceColumnFamilyUpdate(cfm2, false);

    CFMetaData cfm3 = Schema.instance.getCFMetaData(ksName, cfName);
    assertFalse(cfm3.getTriggers().isEmpty());
    assertEquals(1, cfm3.getTriggers().size());
    assertEquals(td, cfm3.getTriggers().get(triggerName));
}
 
Example #5
Source File: TriggersSchemaTest.java    From stratio-cassandra with Apache License 2.0 6 votes vote down vote up
@Test
public void addNewCfWithTriggerToKs() throws Exception
{
    KSMetaData ksm = KSMetaData.newKeyspace(ksName,
                                            SimpleStrategy.class,
                                            Collections.singletonMap("replication_factor", "1"),
                                            true,
                                            Collections.EMPTY_LIST);
    MigrationManager.announceNewKeyspace(ksm);

    CFMetaData cfm1 = CFMetaData.compile(String.format("CREATE TABLE %s (k int PRIMARY KEY, v int)", cfName), ksName);
    TriggerDefinition td = TriggerDefinition.create(triggerName, triggerClass);
    cfm1.addTriggerDefinition(td);

    MigrationManager.announceNewColumnFamily(cfm1);

    CFMetaData cfm2 = Schema.instance.getCFMetaData(ksName, cfName);
    assertFalse(cfm2.getTriggers().isEmpty());
    assertEquals(1, cfm2.getTriggers().size());
    assertEquals(td, cfm2.getTriggers().get(triggerName));
}
 
Example #6
Source File: TriggersSchemaTest.java    From stratio-cassandra with Apache License 2.0 6 votes vote down vote up
@Test
public void newKsContainsCfWithTrigger() throws Exception
{
    TriggerDefinition td = TriggerDefinition.create(triggerName, triggerClass);
    CFMetaData cfm1 = CFMetaData.compile(String.format("CREATE TABLE %s (k int PRIMARY KEY, v int)", cfName), ksName);
    cfm1.addTriggerDefinition(td);
    KSMetaData ksm = KSMetaData.newKeyspace(ksName,
                                            SimpleStrategy.class,
                                            Collections.singletonMap("replication_factor", "1"),
                                            true,
                                            Collections.singletonList(cfm1));
    MigrationManager.announceNewKeyspace(ksm);

    CFMetaData cfm2 = Schema.instance.getCFMetaData(ksName, cfName);
    assertFalse(cfm2.getTriggers().isEmpty());
    assertEquals(1, cfm2.getTriggers().size());
    assertEquals(td, cfm2.getTriggers().get(triggerName));
}
 
Example #7
Source File: CassandraServer.java    From stratio-cassandra with Apache License 2.0 6 votes vote down vote up
/** update an existing keyspace, but do not allow column family modifications.
 * @throws SchemaDisagreementException
 */
public String system_update_keyspace(KsDef ks_def)
throws InvalidRequestException, SchemaDisagreementException, TException
{
    logger.debug("update_keyspace");

    try
    {
        ThriftValidation.validateKeyspaceNotSystem(ks_def.name);
        state().hasKeyspaceAccess(ks_def.name, Permission.ALTER);
        ThriftValidation.validateKeyspace(ks_def.name);
        if (ks_def.getCf_defs() != null && ks_def.getCf_defs().size() > 0)
            throw new InvalidRequestException("Keyspace update must not contain any column family definitions.");

        MigrationManager.announceKeyspaceUpdate(KSMetaData.fromThrift(ks_def));
        return Schema.instance.getVersion().toString();
    }
    catch (RequestValidationException e)
    {
        throw ThriftConversion.toThrift(e);
    }
}
 
Example #8
Source File: CassandraServer.java    From stratio-cassandra with Apache License 2.0 6 votes vote down vote up
public String system_drop_keyspace(String keyspace)
throws InvalidRequestException, SchemaDisagreementException, TException
{
    logger.debug("drop_keyspace");

    try
    {
        ThriftValidation.validateKeyspaceNotSystem(keyspace);
        state().hasKeyspaceAccess(keyspace, Permission.DROP);

        MigrationManager.announceKeyspaceDrop(keyspace);
        return Schema.instance.getVersion().toString();
    }
    catch (RequestValidationException e)
    {
        throw ThriftConversion.toThrift(e);
    }
}
 
Example #9
Source File: CassandraServer.java    From stratio-cassandra with Apache License 2.0 6 votes vote down vote up
public String system_drop_column_family(String column_family)
throws InvalidRequestException, SchemaDisagreementException, TException
{
    logger.debug("drop_column_family");

    ThriftClientState cState = state();

    try
    {
        String keyspace = cState.getKeyspace();
        cState.hasColumnFamilyAccess(keyspace, column_family, Permission.DROP);
        MigrationManager.announceColumnFamilyDrop(keyspace, column_family);
        return Schema.instance.getVersion().toString();
    }
    catch (RequestValidationException e)
    {
        throw ThriftConversion.toThrift(e);
    }
}
 
Example #10
Source File: CassandraServer.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
public String system_update_column_family(CfDef cf_def)
throws InvalidRequestException, SchemaDisagreementException, TException
{
    logger.debug("update_column_family");

    try
    {
        if (cf_def.keyspace == null || cf_def.name == null)
            throw new InvalidRequestException("Keyspace and CF name must be set.");

        state().hasColumnFamilyAccess(cf_def.keyspace, cf_def.name, Permission.ALTER);
        CFMetaData oldCfm = Schema.instance.getCFMetaData(cf_def.keyspace, cf_def.name);

        if (oldCfm == null)
            throw new InvalidRequestException("Could not find column family definition to modify.");

        if (!oldCfm.isThriftCompatible())
            throw new InvalidRequestException("Cannot modify CQL3 table " + oldCfm.cfName + " as it may break the schema. You should use cqlsh to modify CQL3 tables instead.");

        CFMetaData cfm = CFMetaData.fromThriftForUpdate(cf_def, oldCfm);
        CFMetaData.validateCompactionOptions(cfm.compactionStrategyClass, cfm.compactionStrategyOptions);
        cfm.addDefaultIndexNames();

        if (!oldCfm.getTriggers().equals(cfm.getTriggers()))
            state().ensureIsSuper("Only superusers are allowed to add or remove triggers.");

        MigrationManager.announceColumnFamilyUpdate(cfm, true);
        return Schema.instance.getVersion().toString();
    }
    catch (RequestValidationException e)
    {
        throw ThriftConversion.toThrift(e);
    }
}
 
Example #11
Source File: DropTableStatement.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
public boolean announceMigration(boolean isLocalOnly) throws ConfigurationException
{
    try
    {
        MigrationManager.announceColumnFamilyDrop(keyspace(), columnFamily(), isLocalOnly);
        return true;
    }
    catch (ConfigurationException e)
    {
        if (ifExists)
            return false;
        throw e;
    }
}
 
Example #12
Source File: SchemaLoader.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void loadSchema() throws ConfigurationException
{
    prepareServer();

    // Migrations aren't happy if gossiper is not started.  Even if we don't use migrations though,
    // some tests now expect us to start gossip for them.
    startGossiper();

    // if you're messing with low-level sstable stuff, it can be useful to inject the schema directly
    // Schema.instance.load(schemaDefinition());
    for (KSMetaData ksm : schemaDefinition())
        MigrationManager.announceNewKeyspace(ksm);
}
 
Example #13
Source File: CreateTriggerStatement.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
public boolean announceMigration(boolean isLocalOnly) throws ConfigurationException, InvalidRequestException
{
    CFMetaData cfm = Schema.instance.getCFMetaData(keyspace(), columnFamily()).copy();

    TriggerDefinition triggerDefinition = TriggerDefinition.create(triggerName, triggerClass);

    if (!ifNotExists || !cfm.containsTriggerDefinition(triggerDefinition))
    {
        cfm.addTriggerDefinition(triggerDefinition);
        logger.info("Adding trigger with name {} and class {}", triggerName, triggerClass);
        MigrationManager.announceColumnFamilyUpdate(cfm, false, isLocalOnly);
        return true;
    }
    return false;
}
 
Example #14
Source File: CreateIndexStatement.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
public boolean announceMigration(boolean isLocalOnly) throws RequestValidationException
{
    CFMetaData cfm = Schema.instance.getCFMetaData(keyspace(), columnFamily()).copy();
    IndexTarget target = rawTarget.prepare(cfm);
    logger.debug("Updating column {} definition for index {}", target.column, indexName);
    ColumnDefinition cd = cfm.getColumnDefinition(target.column);

    if (cd.getIndexType() != null && ifNotExists)
        return false;

    if (properties.isCustom)
    {
        cd.setIndexType(IndexType.CUSTOM, properties.getOptions());
    }
    else if (cfm.comparator.isCompound())
    {
        Map<String, String> options = Collections.emptyMap();
        // For now, we only allow indexing values for collections, but we could later allow
        // to also index map keys, so we record that this is the values we index to make our
        // lives easier then.
        if (cd.type.isCollection() && cd.type.isMultiCell())
            options = ImmutableMap.of(target.isCollectionKeys ? SecondaryIndex.INDEX_KEYS_OPTION_NAME
                                                              : SecondaryIndex.INDEX_VALUES_OPTION_NAME, "");
        cd.setIndexType(IndexType.COMPOSITES, options);
    }
    else
    {
        cd.setIndexType(IndexType.KEYS, Collections.<String, String>emptyMap());
    }

    cd.setIndexName(indexName);
    cfm.addDefaultIndexNames();
    MigrationManager.announceColumnFamilyUpdate(cfm, false, isLocalOnly);
    return true;
}
 
Example #15
Source File: AlterKeyspaceStatement.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
public boolean announceMigration(boolean isLocalOnly) throws RequestValidationException
{
    KSMetaData ksm = Schema.instance.getKSMetaData(name);
    // In the (very) unlikely case the keyspace was dropped since validate()
    if (ksm == null)
        throw new InvalidRequestException("Unknown keyspace " + name);

    MigrationManager.announceKeyspaceUpdate(attrs.asKSMetadataUpdate(ksm), isLocalOnly);
    return true;
}
 
Example #16
Source File: DropTriggerStatement.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
public boolean announceMigration(boolean isLocalOnly) throws ConfigurationException, InvalidRequestException
{
    CFMetaData cfm = Schema.instance.getCFMetaData(keyspace(), columnFamily()).copy();
    if (cfm.removeTrigger(triggerName))
    {
        logger.info("Dropping trigger with name {}", triggerName);
        MigrationManager.announceColumnFamilyUpdate(cfm, false, isLocalOnly);
        return true;
    }
    if (!ifExists)
        throw new InvalidRequestException(String.format("Trigger %s was not found", triggerName));
    return false;
}
 
Example #17
Source File: DatabaseDescriptorTest.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
@Test
public void testTransKsMigration() throws ConfigurationException
{
    SchemaLoader.cleanupAndLeaveDirs();
    DatabaseDescriptor.loadSchemas();
    assertEquals(0, Schema.instance.getNonSystemKeyspaces().size());

    Gossiper.instance.start((int)(System.currentTimeMillis() / 1000));
    Keyspace.setInitialized();

    try
    {
        // add a few.
        MigrationManager.announceNewKeyspace(KSMetaData.testMetadata("ks0", SimpleStrategy.class, KSMetaData.optsWithRF(3)));
        MigrationManager.announceNewKeyspace(KSMetaData.testMetadata("ks1", SimpleStrategy.class, KSMetaData.optsWithRF(3)));

        assertNotNull(Schema.instance.getKSMetaData("ks0"));
        assertNotNull(Schema.instance.getKSMetaData("ks1"));

        Schema.instance.clearKeyspaceDefinition(Schema.instance.getKSMetaData("ks0"));
        Schema.instance.clearKeyspaceDefinition(Schema.instance.getKSMetaData("ks1"));

        assertNull(Schema.instance.getKSMetaData("ks0"));
        assertNull(Schema.instance.getKSMetaData("ks1"));

        DatabaseDescriptor.loadSchemas();

        assertNotNull(Schema.instance.getKSMetaData("ks0"));
        assertNotNull(Schema.instance.getKSMetaData("ks1"));
    }
    finally
    {
        Gossiper.instance.stop();
    }
}
 
Example #18
Source File: DefsTest.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
@Test
public void addNewCfToBogusKeyspace()
{
    CFMetaData newCf = addTestCF("MadeUpKeyspace", "NewCF", "new cf");
    try
    {
        MigrationManager.announceNewColumnFamily(newCf);
        throw new AssertionError("You shouldn't be able to do anything to a keyspace that doesn't exist.");
    }
    catch (ConfigurationException expected)
    {
    }
}
 
Example #19
Source File: CreateKeyspaceStatement.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
public boolean announceMigration(boolean isLocalOnly) throws RequestValidationException
{
    try
    {
        MigrationManager.announceNewKeyspace(attrs.asKSMetadata(name), isLocalOnly);
        return true;
    }
    catch (AlreadyExistsException e)
    {
        if (ifNotExists)
            return false;
        throw e;
    }
}
 
Example #20
Source File: CreateTableStatement.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
public boolean announceMigration(boolean isLocalOnly) throws RequestValidationException
{
    try
    {
        MigrationManager.announceNewColumnFamily(getCFMetaData(), isLocalOnly);
        return true;
    }
    catch (AlreadyExistsException e)
    {
        if (ifNotExists)
            return false;
        throw e;
    }
}
 
Example #21
Source File: DropKeyspaceStatement.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
public boolean announceMigration(boolean isLocalOnly) throws ConfigurationException
{
    try
    {
        MigrationManager.announceKeyspaceDrop(keyspace, isLocalOnly);
        return true;
    }
    catch(ConfigurationException e)
    {
        if (ifExists)
            return false;
        throw e;
    }
}
 
Example #22
Source File: CassandraServer.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
public String system_add_keyspace(KsDef ks_def)
throws InvalidRequestException, SchemaDisagreementException, TException
{
    logger.debug("add_keyspace");

    try
    {
        ThriftValidation.validateKeyspaceNotSystem(ks_def.name);
        state().hasAllKeyspacesAccess(Permission.CREATE);
        ThriftValidation.validateKeyspaceNotYetExisting(ks_def.name);

        // generate a meaningful error if the user setup keyspace and/or column definition incorrectly
        for (CfDef cf : ks_def.cf_defs)
        {
            if (!cf.getKeyspace().equals(ks_def.getName()))
            {
                throw new InvalidRequestException("CfDef (" + cf.getName() +") had a keyspace definition that did not match KsDef");
            }
        }

        Collection<CFMetaData> cfDefs = new ArrayList<CFMetaData>(ks_def.cf_defs.size());
        for (CfDef cf_def : ks_def.cf_defs)
        {
            cf_def.unsetId(); // explicitly ignore any id set by client (same as system_add_column_family)
            CFMetaData cfm = CFMetaData.fromThrift(cf_def);
            cfm.addDefaultIndexNames();

            if (!cfm.getTriggers().isEmpty())
                state().ensureIsSuper("Only superusers are allowed to add triggers.");

            cfDefs.add(cfm);
        }
        MigrationManager.announceNewKeyspace(KSMetaData.fromThrift(ks_def, cfDefs.toArray(new CFMetaData[cfDefs.size()])));
        return Schema.instance.getVersion().toString();
    }
    catch (RequestValidationException e)
    {
        throw ThriftConversion.toThrift(e);
    }
}
 
Example #23
Source File: DropIndexStatement.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
public boolean announceMigration(boolean isLocalOnly) throws InvalidRequestException, ConfigurationException
{
    CFMetaData cfm = findIndexedCF();
    if (cfm == null)
        return false;

    CFMetaData updatedCfm = updateCFMetadata(cfm);
    indexedCF = updatedCfm.cfName;
    MigrationManager.announceColumnFamilyUpdate(updatedCfm, false, isLocalOnly);
    return true;
}
 
Example #24
Source File: MigrationRequestVerbHandler.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
public void doVerb(MessageIn message, int id)
{
    logger.debug("Received migration request from {}.", message.from);
    MessageOut<Collection<Mutation>> response = new MessageOut<>(MessagingService.Verb.INTERNAL_RESPONSE,
                                                                 SystemKeyspace.serializeSchema(),
                                                                 MigrationManager.MigrationsSerializer.instance);
    MessagingService.instance().sendReply(response, id, message.from);
}
 
Example #25
Source File: Schema.java    From stratio-cassandra with Apache License 2.0 4 votes vote down vote up
public void updateVersionAndAnnounce()
{
    updateVersion();
    MigrationManager.passiveAnnounce(version);
}
 
Example #26
Source File: QueryProcessor.java    From stratio-cassandra with Apache License 2.0 4 votes vote down vote up
private QueryProcessor()
{
    MigrationManager.instance.register(new MigrationSubscriber());
}
 
Example #27
Source File: DefsTables.java    From stratio-cassandra with Apache License 2.0 4 votes vote down vote up
private static void dropKeyspace(String ksName)
{
    KSMetaData ksm = Schema.instance.getKSMetaData(ksName);
    String snapshotName = Keyspace.getTimestampedSnapshotName(ksName);

    CompactionManager.instance.interruptCompactionFor(ksm.cfMetaData().values(), true);

    Keyspace keyspace = Keyspace.open(ksm.name);

    // remove all cfs from the keyspace instance.
    List<UUID> droppedCfs = new ArrayList<>();
    for (CFMetaData cfm : ksm.cfMetaData().values())
    {
        ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(cfm.cfName);

        Schema.instance.purge(cfm);

        if (!StorageService.instance.isClientMode())
        {
            if (DatabaseDescriptor.isAutoSnapshot())
                cfs.snapshot(snapshotName);
            Keyspace.open(ksm.name).dropCf(cfm.cfId);
        }

        droppedCfs.add(cfm.cfId);
    }

    // remove the keyspace from the static instances.
    Keyspace.clear(ksm.name);
    Schema.instance.clearKeyspaceDefinition(ksm);

    keyspace.writeOrder.awaitNewBarrier();

    // force a new segment in the CL
    CommitLog.instance.forceRecycleAllSegments(droppedCfs);

    if (!StorageService.instance.isClientMode())
    {
        MigrationManager.instance.notifyDropKeyspace(ksm);
    }
}
 
Example #28
Source File: SizeEstimatesRecorder.java    From stratio-cassandra with Apache License 2.0 4 votes vote down vote up
private SizeEstimatesRecorder()
{
    MigrationManager.instance.register(this);
}
 
Example #29
Source File: AlterTypeStatement.java    From stratio-cassandra with Apache License 2.0 4 votes vote down vote up
public boolean announceMigration(boolean isLocalOnly) throws InvalidRequestException, ConfigurationException
{
    KSMetaData ksm = Schema.instance.getKSMetaData(name.getKeyspace());
    if (ksm == null)
        throw new InvalidRequestException(String.format("Cannot alter type in unknown keyspace %s", name.getKeyspace()));

    UserType toUpdate = ksm.userTypes.getType(name.getUserTypeName());
    // Shouldn't happen, unless we race with a drop
    if (toUpdate == null)
        throw new InvalidRequestException(String.format("No user type named %s exists.", name));

    UserType updated = makeUpdatedType(toUpdate);

    // Now, we need to announce the type update to basically change it for new tables using this type,
    // but we also need to find all existing user types and CF using it and change them.
    MigrationManager.announceTypeUpdate(updated, isLocalOnly);

    for (CFMetaData cfm : ksm.cfMetaData().values())
    {
        CFMetaData copy = cfm.copy();
        boolean modified = false;
        for (ColumnDefinition def : copy.allColumns())
            modified |= updateDefinition(copy, def, toUpdate.keyspace, toUpdate.name, updated);
        if (modified)
            MigrationManager.announceColumnFamilyUpdate(copy, false, isLocalOnly);
    }

    // Other user types potentially using the updated type
    for (UserType ut : ksm.userTypes.getAllTypes().values())
    {
        // Re-updating the type we've just updated would be harmless but useless so we avoid it.
        // Besides, we use the occasion to drop the old version of the type if it's a type rename
        if (ut.keyspace.equals(toUpdate.keyspace) && ut.name.equals(toUpdate.name))
        {
            if (!ut.keyspace.equals(updated.keyspace) || !ut.name.equals(updated.name))
                MigrationManager.announceTypeDrop(ut);
            continue;
        }
        AbstractType<?> upd = updateWith(ut, toUpdate.keyspace, toUpdate.name, updated);
        if (upd != null)
            MigrationManager.announceTypeUpdate((UserType) upd, isLocalOnly);
    }
    return true;
}