mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-23 18:10:39 +00:00
Merge "Fix for snapshots/create_links and shared SSTables" from Glauber
"Those are fixes needed for the snapshotting process itself. I have bundled this in the create_snapshot series before to avoid a rebase, but since I will have to rewrite that to get rid of the snapshot manager (and go to the filesystem), I am sending those out on their own."
This commit is contained in:
15
database.cc
15
database.cc
@@ -1691,7 +1691,18 @@ future<> column_family::snapshot(sstring name) {
|
||||
return parallel_for_each(tables, [name](sstables::shared_sstable sstable) {
|
||||
auto dir = sstable->get_dir() + "/snapshots/" + name;
|
||||
return recursive_touch_directory(dir).then([sstable, dir] {
|
||||
return sstable->create_links(dir);
|
||||
return sstable->create_links(dir).then_wrapped([] (future<> f) {
|
||||
// If the SSTables are shared, one of the CPUs will fail here.
|
||||
// That is completely fine, though. We only need one link.
|
||||
try {
|
||||
f.get();
|
||||
} catch (std::system_error& e) {
|
||||
if (e.code() != std::error_code(EEXIST, std::system_category())) {
|
||||
throw;
|
||||
}
|
||||
}
|
||||
return make_ready_future<>();
|
||||
});
|
||||
});
|
||||
}).then([jsondir, &tables] {
|
||||
// This is not just an optimization. If we have no files, jsondir may not have been created,
|
||||
@@ -1701,7 +1712,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) {
|
||||
|
||||
Reference in New Issue
Block a user