alternator: refuse CreateTable if uses unsupported features

If a user tries to create a table with a unsupported feature -
a local secondary index, a used-defined encryption key or supporting
streams (CDC), let's refuse the table creation, so the application
doesn't continue thinking this feature is available to it.

The "Tags" feature is also not supported, but it is more harmless
(it is used mostly for accounting purposes) so we do not fail the
table creation because of it.

Signed-off-by: Nadav Har'El <nyh@scylladb.com>
Message-Id: <20190818125528.9091-1-nyh@scylladb.com>
This commit is contained in:
Nadav Har'El
2019-08-18 15:55:28 +03:00
parent 0af6ab6fc6
commit 3044f71438

View File

@@ -419,6 +419,18 @@ future<json::json_return_type> executor::create_table(std::string content) {
view_builders.emplace_back(std::move(view_builder));
}
}
if (rjson::find(table_info, "LocalSecondaryIndexes")) {
throw api_error("ValidationException", "LocalSecondaryIndexes: not yet supported.");
}
if (rjson::find(table_info, "SSESpecification")) {
throw api_error("ValidationException", "SSESpecification: configuring encryption-at-rest is not yet supported.");
}
if (rjson::find(table_info, "StreamSpecification")) {
throw api_error("ValidationException", "StreamSpecification: streams (CDC) is not yet supported.");
}
// FIXME: we should read the Tags property, and save them somewhere.
return futurize_apply([&] { return _mm.announce_new_column_family(schema, false); }).then([table_info = std::move(table_info), schema, view_builders = std::move(view_builders)] () mutable {
return parallel_for_each(std::move(view_builders), [schema] (schema_builder builder) {
return service::get_local_migration_manager().announce_new_view(view_ptr(builder.build()));