From 218fdebbeb26eeae0bbd91c71dd2113519729510 Mon Sep 17 00:00:00 2001 From: Glauber Costa Date: Sat, 17 Oct 2015 13:34:25 +0200 Subject: [PATCH] snapshot: do not allow exceptions in snapshot creation hang us With the distribute-and-sync method we are using, if an exception happens in the snapshot creation for any reason (think file permissions, etc), that will just hang the server since our shard won't do the necessary work to synchronize and note that we done our part (or tried to) in snapshot creation. Make the then clause a finally, so that the sync part is always executed. Signed-off-by: Glauber Costa --- database.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database.cc b/database.cc index 9daad806a1..e98765141d 100644 --- a/database.cc +++ b/database.cc @@ -1709,7 +1709,7 @@ future<> column_family::snapshot(sstring name) { } else { return make_ready_future<>(); } - }).then([this, &tables, jsondir] { + }).finally([this, &tables, jsondir] { auto shard = std::hash()(jsondir) % smp::count; std::unordered_set table_names; for (auto& sst : tables) {