public void announceMigration() throws InvalidRequestException, ConfigurationException
{
logger.debug("Updating column {} definition for index {}", columnName, indexName);
CFMetaData cfm = Schema.instance.getCFMetaData(keyspace(), columnFamily()).clone();
CFDefinition cfDef = cfm.getCfDef();
ColumnDefinition cd = cfm.getColumnDefinition(columnName.key);
if (isCustom)
{
try
{
cd.setIndexType(IndexType.CUSTOM, props.getOptions());
}
catch (SyntaxException e)
{
throw new AssertionError(); // can't happen after validation.
}
}
else if (cfDef.isComposite)
{
CompositeType composite = (CompositeType)cfm.comparator;
Map<String, String> opts = new HashMap<String, String>();
opts.put(CompositesIndex.PREFIX_SIZE_OPTION, String.valueOf(composite.types.size() - (cfDef.hasCollections ? 2 : 1)));
cd.setIndexType(IndexType.COMPOSITES, opts);
}
else
{
cd.setIndexType(IndexType.KEYS, Collections.<String, String>emptyMap());
}
cd.setIndexName(indexName);
cfm.addDefaultIndexNames();
MigrationManager.announceColumnFamilyUpdate(cfm);
}