From d6a8626e905c44ecbbcd31290d2bb3f2357433db Mon Sep 17 00:00:00 2001 From: Nadav Har'El Date: Tue, 6 Aug 2019 12:44:44 +0300 Subject: [PATCH] alternator: correct catch table-already-exists exception Our CreateTable handler assumed that the function migration_manager::announce_new_column_family() returns a failed future if the table already exists. But in some of our code branches, this is not the case - the function itself throws instead of returning a failed future. The solution is to use seastar::futurize_apply() to handle both possibilities (direct exception or future holding an exception). This fixes a failure of the test_table.py::test_create_table_already_exists test case. Signed-off-by: Nadav Har'El --- alternator/executor.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alternator/executor.cc b/alternator/executor.cc index cc4f3c1893..baf5683ce8 100644 --- a/alternator/executor.cc +++ b/alternator/executor.cc @@ -252,7 +252,7 @@ future executor::create_table(std::string content) { schema_ptr schema = builder.build(); - return _mm.announce_new_column_family(schema, false).then([table_info = std::move(table_info), schema] () mutable { + return futurize_apply([&] { return _mm.announce_new_column_family(schema, false); }).then([table_info = std::move(table_info), schema] () mutable { Json::Value status(Json::objectValue); supplement_table_info(table_info, *schema); status["TableDescription"] = std::move(table_info);