directories: Keep a unique set of directories to initialize
If any two directories of data/commitlog/hints/view_hints are the same we still end up running verify_owner_and_mode and disk_sanity(check_direct_io_support) in parallel on the same directoriea and hit #5510. This change uses std::set rather than std::vector to collect a unique set of directories that need initialization. Fixes #5510 Signed-off-by: Benny Halevy <bhalevy@scylladb.com> Message-Id: <20191225160645.2051184-1-bhalevy@scylladb.com>
This commit is contained in:
@@ -62,21 +62,21 @@ future<> directories::touch_and_lock(fs::path path) {
|
||||
});
|
||||
}
|
||||
|
||||
static void add(fs::path path, std::vector<fs::path>& to) {
|
||||
to.push_back(path);
|
||||
static void add(fs::path path, std::set<fs::path>& to) {
|
||||
to.insert(path);
|
||||
}
|
||||
|
||||
static void add(sstring path, std::vector<fs::path>& to) {
|
||||
static void add(sstring path, std::set<fs::path>& to) {
|
||||
add(fs::path(path), to);
|
||||
}
|
||||
|
||||
static void add(std::vector<sstring> paths, std::vector<fs::path>& to) {
|
||||
static void add(std::vector<sstring> paths, std::set<fs::path>& to) {
|
||||
for (auto& path : paths) {
|
||||
add(path, to);
|
||||
}
|
||||
}
|
||||
|
||||
static void add_sharded(sstring p, std::vector<fs::path>& to) {
|
||||
static void add_sharded(sstring p, std::set<fs::path>& to) {
|
||||
fs::path path(p);
|
||||
|
||||
for (unsigned i = 0; i < smp::count; i++) {
|
||||
@@ -85,7 +85,7 @@ static void add_sharded(sstring p, std::vector<fs::path>& to) {
|
||||
}
|
||||
|
||||
future<> directories::init(db::config& cfg, bool hinted_handoff_enabled) {
|
||||
std::vector<fs::path> paths;
|
||||
std::set<fs::path> paths;
|
||||
|
||||
add(cfg.data_file_directories(), paths);
|
||||
add(cfg.commitlog_directory(), paths);
|
||||
|
||||
Reference in New Issue
Block a user