migration_manager: Fail announce_new_keyspace if keyspace already exists

If keyspace already exists, throw a already_exists_exception like Origin
does. Spotted while reading the code.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
This commit is contained in:
Pekka Enberg
2015-05-20 11:41:09 +03:00
committed by Avi Kivity
parent f8c8a55bfe
commit 866d39b5dc

View File

@@ -218,10 +218,11 @@ future<> migration_manager::announce_new_keyspace(service::storage_proxy& proxy,
{
#if 0
ksm.validate();
if (Schema.instance.getKSMetaData(ksm.name) != null)
throw new AlreadyExistsException(ksm.name);
#endif
if (proxy.get_db().local().has_keyspace(ksm->name())) {
throw exceptions::already_exists_exception{ksm->name()};
}
#if 0
logger.info(String.format("Create new Keyspace: %s", ksm));
#endif
auto mutations = db::legacy_schema_tables::make_create_keyspace_mutations(ksm, timestamp);