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 <glommer@scylladb.com>
This commit is contained in:
Glauber Costa
2015-10-17 13:34:25 +02:00
parent 9083a0e5a7
commit 218fdebbeb

View File

@@ -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<sstring>()(jsondir) % smp::count;
std::unordered_set<sstring> table_names;
for (auto& sst : tables) {