From 3044f7143829bd59c84ece0b5cb455042e29a918 Mon Sep 17 00:00:00 2001 From: Nadav Har'El Date: Sun, 18 Aug 2019 15:55:28 +0300 Subject: [PATCH] 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 Message-Id: <20190818125528.9091-1-nyh@scylladb.com> --- alternator/executor.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/alternator/executor.cc b/alternator/executor.cc index 56cafbedf6..9b98b781ed 100644 --- a/alternator/executor.cc +++ b/alternator/executor.cc @@ -419,6 +419,18 @@ future 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()));