From: Zhiqiang Wang Date: Wed, 4 Jan 2017 08:03:08 +0000 (+0800) Subject: osd: trim primary pglog as well when recovery finishes on a peer X-Git-Tag: v12.0.3~128^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5e40b4364224c25659655f59c2c2d6a1dc966d74;p=ceph.git osd: trim primary pglog as well when recovery finishes on a peer When recovery finishes on primary or on a peer, primary trims pglog on the peer osds, or peer informs primary to trim pglog. In both of these cases, trim primary pglog as well as pglog on the peers. Signed-off-by: Zhiqiang Wang --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 5b9903a7f90c0..d4e88f6c1b3b1 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -2951,12 +2951,13 @@ void PG::write_if_dirty(ObjectStore::Transaction& t) t.omap_setkeys(coll, pgmeta_oid, km); } -void PG::trim_peers() +void PG::trim_log() { assert(is_primary()); calc_trim_to(); - dout(10) << "trim_peers " << pg_trim_to << dendl; + dout(10) << __func__ << " to " << pg_trim_to << dendl; if (pg_trim_to != eversion_t()) { + // inform peers to trim log assert(!actingbackfill.empty()); for (set::iterator i = actingbackfill.begin(); i != actingbackfill.end(); @@ -2970,6 +2971,10 @@ void PG::trim_peers() pg_trim_to), get_osdmap()->get_epoch()); } + + // trim primary as well + pg_log.trim(pg_trim_to, info); + dirty_info = true; } } diff --git a/src/osd/PG.h b/src/osd/PG.h index 607fadad70390..70133d052fd05 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -2239,7 +2239,7 @@ public: ObjectStore::Transaction &t, bool transaction_applied = true); bool check_log_for_corruption(ObjectStore *store); - void trim_peers(); + void trim_log(); std::string get_corrupt_pg_log_name() const; static int read_info(