From c2211e851dc2c503355b94c8adfc7d1c6780cd74 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 23 Oct 2018 14:15:25 -0500 Subject: [PATCH] crush/CrushWrapper: reclassify: handle to-be-created buckets that we need twice Signed-off-by: Sage Weil --- src/crush/CrushWrapper.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index c428fade86b..e98f1a6cfef 100644 --- a/src/crush/CrushWrapper.cc +++ b/src/crush/CrushWrapper.cc @@ -1813,6 +1813,7 @@ int CrushWrapper::reclassify( map> new_class_bucket; map new_bucket_names; map> new_buckets; + map new_bucket_by_name; for (auto& i : classify_bucket) { const string& match = i.first; // prefix% or %suffix const string& new_class = i.second.first; @@ -1878,6 +1879,9 @@ int CrushWrapper::reclassify( if (name_exists(basename)) { base_id = get_item_id(basename); cout << " have base " << base_id << std::endl; + } else if (new_bucket_by_name.count(basename)) { + base_id = new_bucket_by_name[basename]; + cout << " already creating base " << base_id << std::endl; } else { base_id = get_new_bucket_id(); crush->buckets[-1-base_id] = crush_make_bucket(crush, @@ -1887,6 +1891,7 @@ int CrushWrapper::reclassify( 0, NULL, NULL); crush->buckets[-1-base_id]->id = base_id; name_map[base_id] = basename; + new_bucket_by_name[basename] = base_id; cout << " created base " << base_id << std::endl; new_buckets[base_id][default_parent_type_name] = default_parent; -- 2.39.5