From cd3b35a3d671c1621d2194d5ab80a7802cb1be20 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Thu, 13 Jan 2011 11:02:58 -0800 Subject: [PATCH] PG: added adjust_local_snaps, activate now checks local collections adjust_local_snaps handles removing local collections contained in to_check. On activate, pg will now remove local collections contained in purged_snaps. Signed-off-by: Samuel Just --- src/osd/PG.cc | 16 +++++++++++++++- src/osd/PG.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index ae551c3affcc8..114574c4e6907 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -1827,6 +1827,9 @@ void PG::activate(ObjectStore::Transaction& t, list& tfin, queue_snap_trim(); } + // Check local snaps + adjust_local_snaps(t, info.purged_snaps); + // init complete pointer if (missing.num_missing() == 0 && info.last_complete != info.last_update) { @@ -2688,7 +2691,18 @@ coll_t PG::make_snap_collection(ObjectStore::Transaction& t, snapid_t s) return c; } - +void PG::adjust_local_snaps(ObjectStore::Transaction &t, interval_set &to_check) +{ + interval_set to_remove; + to_remove.intersection_of(snap_collections, to_check); + while (!to_remove.empty()) { + snapid_t current = to_remove.range_start(); + coll_t c(info.pgid, current); + t.remove_collection(c); + snap_collections.erase(current); + } + write_info(t); +} // ============================== diff --git a/src/osd/PG.h b/src/osd/PG.h index a76029a1c0597..6ef6a89f3d701 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -991,6 +991,7 @@ public: std::string get_corrupt_pg_log_name() const; void read_state(ObjectStore *store); coll_t make_snap_collection(ObjectStore::Transaction& t, snapid_t sn); + void adjust_local_snaps(ObjectStore::Transaction &t, interval_set &to_check); void queue_snap_trim(); -- 2.39.5