public CFMetaData copy() { return copy(cfId); }
public CFMetaData copy() { return copy(cfId); }
public CFMetaData copy() { return copy(cfId); }
public ViewDefinition copy() { return new ViewDefinition(ksName, viewName, baseTableId, baseTableName, includeAllColumns, select, whereClause, metadata.copy()); }
public ViewDefinition copy() { return new ViewDefinition(ksName, viewName, baseTableId, baseTableName, includeAllColumns, select, whereClause, metadata.copy()); }
public ViewDefinition copy() { return new ViewDefinition(ksName, viewName, baseTableId, baseTableName, includeAllColumns, select, whereClause, metadata.copy()); }
public Tables copy() { return builder().add(tables.values().stream().map(t -> t.copy()).collect(Collectors.toList())).build(); }
public CFMetaData dropIndex(CFMetaData cfm) { CFMetaData updatedCfm = cfm.copy(); updatedCfm.indexes(updatedCfm.getIndexes().without(indexName)); return updatedCfm; }
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; }
private CFMetaData updateCFMetadata(CFMetaData cfm) { ColumnDefinition column = findIndexedColumn(cfm); assert column != null; CFMetaData cloned = cfm.copy(); ColumnDefinition toChange = cloned.getColumnDefinition(column.name); assert toChange.getIndexName() != null && toChange.getIndexName().equals(indexName); toChange.setIndexName(null); toChange.setIndexType(null, null); return cloned; }
private CFMetaData updateCFMetadata(CFMetaData cfm) { ColumnDefinition column = findIndexedColumn(cfm); assert column != null; CFMetaData cloned = cfm.copy(); ColumnDefinition toChange = cloned.getColumnDefinition(column.name); assert toChange.getIndexName() != null && toChange.getIndexName().equals(indexName); toChange.setIndexName(null); toChange.setIndexType(null, null); return cloned; }
/** * Creates the table according to schema statement * * @param types types this table should be created with */ private CFMetaData createTable(Types types) { CreateTableStatement statement = (CreateTableStatement) schemaStatement.prepare(types).statement; statement.validate(ClientState.forInternalCalls()); CFMetaData cfMetaData = statement.getCFMetaData(); if (partitioner != null) return cfMetaData.copy(partitioner); else return cfMetaData; }
/** * Creates the table according to schema statement * * @param types types this table should be created with */ private CFMetaData createTable(Types types) { CreateTableStatement statement = (CreateTableStatement) schemaStatement.prepare(types).statement; statement.validate(ClientState.forInternalCalls()); CFMetaData cfMetaData = statement.getCFMetaData(); if (partitioner != null) return cfMetaData.copy(partitioner); else return cfMetaData; }
/** * Creates the table according to schema statement * * @param types types this table should be created with */ private CFMetaData createTable(Types types) { CreateTableStatement statement = (CreateTableStatement) schemaStatement.prepare(types).statement; statement.validate(ClientState.forInternalCalls()); CFMetaData cfMetaData = statement.getCFMetaData(); if (partitioner != null) return cfMetaData.copy(partitioner); else return cfMetaData; }
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; }
public Event.SchemaChange announceMigration(QueryState queryState, boolean isLocalOnly) throws InvalidRequestException, ConfigurationException { CFMetaData cfm = lookupIndexedTable(); if (cfm == null) return null; CFMetaData updatedCfm = cfm.copy(); updatedCfm.indexes(updatedCfm.getIndexes().without(indexName)); MigrationManager.announceColumnFamilyUpdate(updatedCfm, isLocalOnly); // Dropping an index is akin to updating the CF // Note that we shouldn't call columnFamily() at this point because the index has been dropped and the call to lookupIndexedTable() // in that method would now throw. return new Event.SchemaChange(Event.SchemaChange.Change.UPDATED, Event.SchemaChange.Target.TABLE, cfm.ksName, cfm.cfName); }
public Event.SchemaChange announceMigration(QueryState queryState, boolean isLocalOnly) throws InvalidRequestException, ConfigurationException { CFMetaData cfm = lookupIndexedTable(); if (cfm == null) return null; CFMetaData updatedCfm = cfm.copy(); updatedCfm.indexes(updatedCfm.getIndexes().without(indexName)); MigrationManager.announceColumnFamilyUpdate(updatedCfm, isLocalOnly); // Dropping an index is akin to updating the CF // Note that we shouldn't call columnFamily() at this point because the index has been dropped and the call to lookupIndexedTable() // in that method would now throw. return new Event.SchemaChange(Event.SchemaChange.Change.UPDATED, Event.SchemaChange.Target.TABLE, cfm.ksName, cfm.cfName); }
public Event.SchemaChange announceMigration(QueryState queryState, boolean isLocalOnly) throws ConfigurationException, InvalidRequestException { CFMetaData cfm = Schema.instance.getCFMetaData(keyspace(), columnFamily()).copy(); Triggers triggers = cfm.getTriggers(); if (!triggers.get(triggerName).isPresent()) { if (ifExists) return null; else throw new InvalidRequestException(String.format("Trigger %s was not found", triggerName)); } logger.info("Dropping trigger with name {}", triggerName); cfm.triggers(triggers.without(triggerName)); MigrationManager.announceColumnFamilyUpdate(cfm, isLocalOnly); return new Event.SchemaChange(Event.SchemaChange.Change.UPDATED, Event.SchemaChange.Target.TABLE, keyspace(), columnFamily()); } }
public Event.SchemaChange announceMigration(QueryState queryState, boolean isLocalOnly) throws ConfigurationException, InvalidRequestException { CFMetaData cfm = Schema.instance.getCFMetaData(keyspace(), columnFamily()).copy(); Triggers triggers = cfm.getTriggers(); if (triggers.get(triggerName).isPresent()) { if (ifNotExists) return null; else throw new InvalidRequestException(String.format("Trigger %s already exists", triggerName)); } cfm.triggers(triggers.with(TriggerMetadata.create(triggerName, triggerClass))); logger.info("Adding trigger with name {} and class {}", triggerName, triggerClass); MigrationManager.announceColumnFamilyUpdate(cfm, isLocalOnly); return new Event.SchemaChange(Event.SchemaChange.Change.UPDATED, Event.SchemaChange.Target.TABLE, keyspace(), columnFamily()); } }
public Event.SchemaChange announceMigration(QueryState queryState, boolean isLocalOnly) throws RequestValidationException { KeyspaceMetadata ksm = Schema.instance.getKSMetaData(keyspace()); CFMetaData cfm0 = Schema.instance.getCFMetaData(keyspace(), columnFamily()).copy(); CFMetaData cfm = createIndex(ksm, cfm0); if (cfm != null) { MigrationManager.announceColumnFamilyUpdate(cfm, isLocalOnly); // Creating an index is akin to updating the CF return new Event.SchemaChange(Event.SchemaChange.Change.UPDATED, Event.SchemaChange.Target.TABLE, keyspace(), columnFamily()); } return null; }