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 void announceNewKeyspace(KeyspaceMetadata ksm) throws ConfigurationException { announceNewKeyspace(ksm, false); }
public static void announceNewKeyspace(KeyspaceMetadata ksm) throws ConfigurationException { announceNewKeyspace(ksm, false); }
public static void announceNewKeyspace(KSMetaData ksm) throws ConfigurationException { announceNewKeyspace(ksm, false); }
public static void announceNewKeyspace(KeyspaceMetadata ksm) throws ConfigurationException { announceNewKeyspace(ksm, false); }
private void maybeAddKeyspace(KeyspaceMetadata ksm) { try { /* * We use timestamp of 0, intentionally, so that varying timestamps wouldn't cause schema mismatches on * newly added nodes. * * Having the initial/default timestamp as 0 also allows users to make and persist changes to replication * of our replicated system keyspaces. * * In case that we need to make incompatible changes to those kesypaces/tables, we'd need to bump the timestamp * on per-keyspace/per-table basis. So far we've never needed to. */ MigrationManager.announceNewKeyspace(ksm, 0, false); } catch (AlreadyExistsException e) { logger.debug("Attempted to create new keyspace {}, but it already exists", ksm.name); } }
private void maybeAddKeyspace(KeyspaceMetadata ksm) { try { /* * We use timestamp of 0, intentionally, so that varying timestamps wouldn't cause schema mismatches on * newly added nodes. * * Having the initial/default timestamp as 0 also allows users to make and persist changes to replication * of our replicated system keyspaces. * * In case that we need to make incompatible changes to those kesypaces/tables, we'd need to bump the timestamp * on per-keyspace/per-table basis. So far we've never needed to. */ MigrationManager.announceNewKeyspace(ksm, 0, false); } catch (AlreadyExistsException e) { logger.debug("Attempted to create new keyspace {}, but it already exists", ksm.name); } }
private void maybeAddKeyspace(KeyspaceMetadata ksm) { try { /* * We use timestamp of 0, intentionally, so that varying timestamps wouldn't cause schema mismatches on * newly added nodes. * * Having the initial/default timestamp as 0 also allows users to make and persist changes to replication * of our replicated system keyspaces. * * In case that we need to make incompatible changes to those kesypaces/tables, we'd need to bump the timestamp * on per-keyspace/per-table basis. So far we've never needed to. */ MigrationManager.announceNewKeyspace(ksm, 0, false); } catch (AlreadyExistsException e) { logger.debug("Attempted to create new keyspace {}, but it already exists", ksm.name); } }
public static void announceNewKeyspace(KeyspaceMetadata ksm, boolean announceLocally) throws ConfigurationException { announceNewKeyspace(ksm, FBUtilities.timestampMicros(), announceLocally); }
public static void announceNewKeyspace(KeyspaceMetadata ksm, boolean announceLocally) throws ConfigurationException { announceNewKeyspace(ksm, FBUtilities.timestampMicros(), announceLocally); }
public static void announceNewKeyspace(KSMetaData ksm, boolean announceLocally) throws ConfigurationException { announceNewKeyspace(ksm, FBUtilities.timestampMicros(), announceLocally); }
public static void announceNewKeyspace(KeyspaceMetadata ksm, boolean announceLocally) throws ConfigurationException { announceNewKeyspace(ksm, FBUtilities.timestampMicros(), announceLocally); }
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; } }
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. } } }
public Event.SchemaChange announceMigration(QueryState queryState, boolean isLocalOnly) throws RequestValidationException { KeyspaceMetadata ksm = KeyspaceMetadata.create(name, attrs.asNewKeyspaceParams()); try { MigrationManager.announceNewKeyspace(ksm, isLocalOnly); return new Event.SchemaChange(Event.SchemaChange.Change.CREATED, keyspace()); } catch (AlreadyExistsException e) { if (ifNotExists) return null; throw e; } }
public Event.SchemaChange announceMigration(QueryState queryState, boolean isLocalOnly) throws RequestValidationException { KeyspaceMetadata ksm = KeyspaceMetadata.create(name, attrs.asNewKeyspaceParams()); try { MigrationManager.announceNewKeyspace(ksm, isLocalOnly); return new Event.SchemaChange(Event.SchemaChange.Change.CREATED, keyspace()); } catch (AlreadyExistsException e) { if (ifNotExists) return null; throw 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); } }
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 Event.SchemaChange announceMigration(QueryState queryState, boolean isLocalOnly) throws RequestValidationException { KeyspaceMetadata ksm = KeyspaceMetadata.create(name, attrs.asNewKeyspaceParams()); try { MigrationManager.announceNewKeyspace(ksm, isLocalOnly); return new Event.SchemaChange(Event.SchemaChange.Change.CREATED, keyspace()); } catch (AlreadyExistsException e) { if (ifNotExists) return null; throw e; } }
MigrationManager.announceNewKeyspace(ThriftConversion.fromThrift(ks_def, cfDefs.toArray(new CFMetaData[cfDefs.size()]))); return Schema.instance.getVersion().toString();