Java Code Examples for org.apache.cassandra.config.DatabaseDescriptor#getTableDefinition()
The following examples show how to use
org.apache.cassandra.config.DatabaseDescriptor#getTableDefinition() .
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: 986499_AddColumnFamily_0_s.java From coming with MIT License | 6 votes |
public AddColumnFamily(CFMetaData cfm) throws ConfigurationException, IOException { super(UUIDGen.makeType1UUIDFromHost(FBUtilities.getLocalAddress()), DatabaseDescriptor.getDefsVersion()); this.cfm = cfm; KSMetaData ksm = DatabaseDescriptor.getTableDefinition(cfm.tableName); if (ksm == null) throw new ConfigurationException("Keyspace does not already exist."); else if (ksm.cfMetaData().containsKey(cfm.cfName)) throw new ConfigurationException("CF is already defined in that keyspace."); else if (!Migration.isLegalName(cfm.cfName)) throw new ConfigurationException("Invalid column family name: " + cfm.cfName); KSMetaData newKsm = makeNewKeyspaceDefinition(ksm); rm = Migration.makeDefinitionMutation(newKsm, null, newVersion); }
Example 2
Source File: 986499_AddColumnFamily_0_s.java From coming with MIT License | 6 votes |
public void applyModels() throws IOException { KSMetaData ksm = DatabaseDescriptor.getTableDefinition(cfm.tableName); ksm = makeNewKeyspaceDefinition(ksm); try { CFMetaData.map(cfm); } catch (ConfigurationException ex) { throw new IOException(ex); } Table.open(cfm.tableName); // make sure it's init-ed w/ the old definitions first, since we're going to call initCf on the new one manually DatabaseDescriptor.setTableDefinition(ksm, newVersion); if (!clientMode) Table.open(ksm.name).initCf(cfm.cfId, cfm.cfName); if (!clientMode) CommitLog.instance().forceNewSegment(); }
Example 3
Source File: 986499_AddColumnFamily_0_t.java From coming with MIT License | 6 votes |
public AddColumnFamily(CFMetaData cfm) throws ConfigurationException, IOException { super(UUIDGen.makeType1UUIDFromHost(FBUtilities.getLocalAddress()), DatabaseDescriptor.getDefsVersion()); this.cfm = cfm; KSMetaData ksm = DatabaseDescriptor.getTableDefinition(cfm.tableName); if (ksm == null) throw new ConfigurationException("Keyspace does not already exist."); else if (ksm.cfMetaData().containsKey(cfm.cfName)) throw new ConfigurationException("CF is already defined in that keyspace."); else if (!Migration.isLegalName(cfm.cfName)) throw new ConfigurationException("Invalid column family name: " + cfm.cfName); KSMetaData newKsm = makeNewKeyspaceDefinition(ksm); rm = Migration.makeDefinitionMutation(newKsm, null, newVersion); }
Example 4
Source File: 986499_AddColumnFamily_0_t.java From coming with MIT License | 6 votes |
public void applyModels() throws IOException { KSMetaData ksm = DatabaseDescriptor.getTableDefinition(cfm.tableName); ksm = makeNewKeyspaceDefinition(ksm); try { CFMetaData.map(cfm); } catch (ConfigurationException ex) { throw new IOException(ex); } Table.open(cfm.tableName); // make sure it's init-ed w/ the old definitions first, since we're going to call initCf on the new one manually DatabaseDescriptor.setTableDefinition(ksm, newVersion); // these definitions could have come from somewhere else. CFMetaData.fixMaxId(); if (!clientMode) Table.open(ksm.name).initCf(cfm.cfId, cfm.cfName); if (!clientMode) CommitLog.instance().forceNewSegment(); }
Example 5
Source File: 986499_AddColumnFamily_0_s.java From coming with MIT License | 6 votes |
public AddColumnFamily(CFMetaData cfm) throws ConfigurationException, IOException { super(UUIDGen.makeType1UUIDFromHost(FBUtilities.getLocalAddress()), DatabaseDescriptor.getDefsVersion()); this.cfm = cfm; KSMetaData ksm = DatabaseDescriptor.getTableDefinition(cfm.tableName); if (ksm == null) throw new ConfigurationException("Keyspace does not already exist."); else if (ksm.cfMetaData().containsKey(cfm.cfName)) throw new ConfigurationException("CF is already defined in that keyspace."); else if (!Migration.isLegalName(cfm.cfName)) throw new ConfigurationException("Invalid column family name: " + cfm.cfName); KSMetaData newKsm = makeNewKeyspaceDefinition(ksm); rm = Migration.makeDefinitionMutation(newKsm, null, newVersion); }
Example 6
Source File: 986499_AddColumnFamily_0_s.java From coming with MIT License | 6 votes |
public void applyModels() throws IOException { KSMetaData ksm = DatabaseDescriptor.getTableDefinition(cfm.tableName); ksm = makeNewKeyspaceDefinition(ksm); try { CFMetaData.map(cfm); } catch (ConfigurationException ex) { throw new IOException(ex); } Table.open(cfm.tableName); DatabaseDescriptor.setTableDefinition(ksm, newVersion); if (!clientMode) Table.open(ksm.name).initCf(cfm.cfId, cfm.cfName); if (!clientMode) CommitLog.instance().forceNewSegment(); }
Example 7
Source File: 986499_AddColumnFamily_0_t.java From coming with MIT License | 6 votes |
public AddColumnFamily(CFMetaData cfm) throws ConfigurationException, IOException { super(UUIDGen.makeType1UUIDFromHost(FBUtilities.getLocalAddress()), DatabaseDescriptor.getDefsVersion()); this.cfm = cfm; KSMetaData ksm = DatabaseDescriptor.getTableDefinition(cfm.tableName); if (ksm == null) throw new ConfigurationException("Keyspace does not already exist."); else if (ksm.cfMetaData().containsKey(cfm.cfName)) throw new ConfigurationException("CF is already defined in that keyspace."); else if (!Migration.isLegalName(cfm.cfName)) throw new ConfigurationException("Invalid column family name: " + cfm.cfName); KSMetaData newKsm = makeNewKeyspaceDefinition(ksm); rm = Migration.makeDefinitionMutation(newKsm, null, newVersion); }
Example 8
Source File: 986499_AddColumnFamily_0_t.java From coming with MIT License | 6 votes |
public void applyModels() throws IOException { KSMetaData ksm = DatabaseDescriptor.getTableDefinition(cfm.tableName); ksm = makeNewKeyspaceDefinition(ksm); try { CFMetaData.map(cfm); } catch (ConfigurationException ex) { throw new IOException(ex); } Table.open(cfm.tableName); DatabaseDescriptor.setTableDefinition(ksm, newVersion); CFMetaData.fixMaxId(); if (!clientMode) Table.open(ksm.name).initCf(cfm.cfId, cfm.cfName); if (!clientMode) CommitLog.instance().forceNewSegment(); }
Example 9
Source File: 986499_AddColumnFamily_0_s.java From coming with MIT License | 6 votes |
public AddColumnFamily(CFMetaData cfm) throws ConfigurationException, IOException { super(UUIDGen.makeType1UUIDFromHost(FBUtilities.getLocalAddress()), DatabaseDescriptor.getDefsVersion()); this.cfm = cfm; KSMetaData ksm = DatabaseDescriptor.getTableDefinition(cfm.tableName); if (ksm == null) throw new ConfigurationException("Keyspace does not already exist."); else if (ksm.cfMetaData().containsKey(cfm.cfName)) throw new ConfigurationException("CF is already defined in that keyspace."); else if (!Migration.isLegalName(cfm.cfName)) throw new ConfigurationException("Invalid column family name: " + cfm.cfName); KSMetaData newKsm = makeNewKeyspaceDefinition(ksm); rm = Migration.makeDefinitionMutation(newKsm, null, newVersion); }
Example 10
Source File: 986499_AddColumnFamily_0_t.java From coming with MIT License | 6 votes |
public AddColumnFamily(CFMetaData cfm) throws ConfigurationException, IOException { super(UUIDGen.makeType1UUIDFromHost(FBUtilities.getLocalAddress()), DatabaseDescriptor.getDefsVersion()); this.cfm = cfm; KSMetaData ksm = DatabaseDescriptor.getTableDefinition(cfm.tableName); if (ksm == null) throw new ConfigurationException("Keyspace does not already exist."); else if (ksm.cfMetaData().containsKey(cfm.cfName)) throw new ConfigurationException("CF is already defined in that keyspace."); else if (!Migration.isLegalName(cfm.cfName)) throw new ConfigurationException("Invalid column family name: " + cfm.cfName); KSMetaData newKsm = makeNewKeyspaceDefinition(ksm); rm = Migration.makeDefinitionMutation(newKsm, null, newVersion); }
Example 11
Source File: 986499_AddColumnFamily_0_t.java From coming with MIT License | 6 votes |
public void applyModels() throws IOException { KSMetaData ksm = DatabaseDescriptor.getTableDefinition(cfm.tableName); ksm = makeNewKeyspaceDefinition(ksm); try { CFMetaData.map(cfm); } catch (ConfigurationException ex) { throw new IOException(ex); } Table.open(cfm.tableName); DatabaseDescriptor.setTableDefinition(ksm, newVersion); CFMetaData.fixMaxId(); if (!clientMode) Table.open(ksm.name).initCf(cfm.cfId, cfm.cfName); if (!clientMode) CommitLog.instance().forceNewSegment(); }