From 4848fac24224879bcdc4fcf202d6ab689d8d990f Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Tue, 7 May 2013 16:41:22 -0700 Subject: [PATCH] OSD: handle stray snap collections from upgrade bug Previously, we failed to clear snap_collections, which causes split to spawn a bunch of snap collections. In load_pgs, we now clear any such snap collections and then snap_collections field on the PG itself. Related: #4927 Signed-off-by: Samuel Just Reviewed-by: Sage Weil (cherry picked from commit 8e89db89cb36a217fd97cbc1f24fd643b62400dc) --- src/osd/OSD.cc | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index c2a7a61b68a7d..cba3f6c0b16c3 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -1775,8 +1775,29 @@ void OSD::load_pgs() dout(10) << "PG " << pg->info.pgid << " must upgrade..." << dendl; pg->upgrade(store, i->second); - } else { - assert(i->second.empty()); + } else if (!i->second.empty()) { + // handle upgrade bug + for (interval_set::iterator j = i->second.begin(); + j != i->second.end(); + ++j) { + for (snapid_t k = j.get_start(); + k != j.get_start() + j.get_len(); + ++k) { + assert(store->collection_empty(coll_t(pgid, k))); + ObjectStore::Transaction t; + t.remove_collection(coll_t(pgid, k)); + store->apply_transaction(t); + } + } + } + + if (!pg->snap_collections.empty()) { + pg->snap_collections.clear(); + pg->dirty_big_info = true; + pg->dirty_info = true; + ObjectStore::Transaction t; + pg->write_if_dirty(t); + store->apply_transaction(t); } service.init_splits_between(pg->info.pgid, pg->get_osdmap(), osdmap); -- 2.39.5