private void ensureKeyspaceExists(String keyspaceName) throws BackendException { if (null != Schema.instance.getKeyspaceInstance(keyspaceName)) return; // Keyspace not found; create it String strategyName = storageConfig.get(REPLICATION_STRATEGY); KSMetaData ksm; try { ksm = KSMetaData.newKeyspace(keyspaceName, strategyName, strategyOptions, true); } catch (ConfigurationException e) { throw new PermanentBackendException("Failed to instantiate keyspace metadata for " + keyspaceName, e); } try { MigrationManager.announceNewKeyspace(ksm); log.info("Created keyspace {}", keyspaceName); } catch (ConfigurationException e) { throw new PermanentBackendException("Failed to create keyspace " + keyspaceName, e); } }
public static KSMetaData newKeyspace(String name, String strategyName, Map<String, String> options, boolean durableWrites) throws ConfigurationException { Class<? extends AbstractReplicationStrategy> cls = AbstractReplicationStrategy.getClass(strategyName); if (cls.equals(LocalStrategy.class)) throw new ConfigurationException("Unable to use given strategy class: LocalStrategy is reserved for internal use."); return newKeyspace(name, cls, options, durableWrites, Collections.<CFMetaData>emptyList()); }
public KSMetaData asKSMetadataUpdate(KSMetaData old) throws RequestValidationException { String sClass = strategyClass; Map<String, String> sOptions = getReplicationOptions(); if (sClass == null) { sClass = old.strategyClass.getName(); sOptions = old.strategyOptions; } return KSMetaData.newKeyspace(old.name, sClass, sOptions, getBoolean(KW_DURABLE_WRITES, old.durableWrites)); } }
private static void setupAuthKeyspace() { if (Schema.instance.getKSMetaData(AUTH_KS) == null) { try { KSMetaData ksm = KSMetaData.newKeyspace(AUTH_KS, SimpleStrategy.class.getName(), ImmutableMap.of("replication_factor", "1"), true); MigrationManager.announceNewKeyspace(ksm, 0, false); } catch (Exception e) { throw new AssertionError(e); // shouldn't ever happen. } } }
/** * Creates a keyspace for the specified column family. * * @param cfm the column family * @throws ConfigurationException if a problem occurs while creating the keyspace. */ private static void createKeyspaceWithTable(CFMetaData cfm) throws ConfigurationException { KSMetaData ksm = KSMetaData.newKeyspace(cfm.ksName, AbstractReplicationStrategy.getClass("org.apache.cassandra.locator.SimpleStrategy"), ImmutableMap.of("replication_factor", "1"), true, Collections.singleton(cfm)); Schema.instance.load(ksm); }
public KSMetaData asKSMetadata(String ksName) throws RequestValidationException { return KSMetaData.newKeyspace(ksName, getReplicationStrategyClass(), getReplicationOptions(), getBoolean(KW_DURABLE_WRITES, true)); }
private void ensureKeyspaceExists(String keyspaceName) throws BackendException { if (null != Schema.instance.getKeyspaceInstance(keyspaceName)) return; // Keyspace not found; create it String strategyName = storageConfig.get(REPLICATION_STRATEGY); KSMetaData ksm; try { ksm = KSMetaData.newKeyspace(keyspaceName, strategyName, strategyOptions, true); } catch (ConfigurationException e) { throw new PermanentBackendException("Failed to instantiate keyspace metadata for " + keyspaceName, e); } try { MigrationManager.announceNewKeyspace(ksm); log.info("Created keyspace {}", keyspaceName); } catch (ConfigurationException e) { throw new PermanentBackendException("Failed to create keyspace " + keyspaceName, e); } }
private void ensureKeyspaceExists(String keyspaceName) throws BackendException { if (null != Schema.instance.getKeyspaceInstance(keyspaceName)) return; // Keyspace not found; create it String strategyName = storageConfig.get(REPLICATION_STRATEGY); KSMetaData ksm; try { ksm = KSMetaData.newKeyspace(keyspaceName, strategyName, strategyOptions, true); } catch (ConfigurationException e) { throw new PermanentBackendException("Failed to instantiate keyspace metadata for " + keyspaceName, e); } try { MigrationManager.announceNewKeyspace(ksm); log.info("Created keyspace {}", keyspaceName); } catch (ConfigurationException e) { throw new PermanentBackendException("Failed to create keyspace " + keyspaceName, e); } }
KSMetaData ksm = KSMetaData.newKeyspace(create.getName(), create.getStrategyClass(), create.getStrategyOptions(),