From: Sage Weil Date: Thu, 20 Jun 2019 17:07:38 +0000 (-0500) Subject: mon/OSDMonitor: record snap removal seq as purged X-Git-Tag: v15.1.0~2308^2~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d831abeae1688a18eb446dd1a63eb6ed94f45d81;p=ceph.git mon/OSDMonitor: record snap removal seq as purged When we delete a selfmanaged snap we have to bump seq. Record this as purged so that we avoid discontinuities in the history and so our storage is a bit more efficient. Signed-off-by: Sage Weil --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index fe82df4b7699..af8de92546bf 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -731,6 +731,7 @@ void OSDMonitor::create_pending() pending_inc.fsid = mon->monmap->fsid; pending_metadata.clear(); pending_metadata_rm.clear(); + pending_pseudo_purged_snaps.clear(); dout(10) << "create_pending e " << pending_inc.epoch << dendl; @@ -1653,6 +1654,13 @@ void OSDMonitor::encode_pending(MonitorDBStore::TransactionRef t) t); } } + for (auto& [pool, snaps] : pending_pseudo_purged_snaps) { + for (auto snap : snaps) { + insert_snap_update(true, pool, snap, snap + 1, + pending_inc.epoch, + t); + } + } // health health_check_map_t next; @@ -13007,6 +13015,10 @@ bool OSDMonitor::prepare_pool_op(MonOpRequestRef op) m->snapid, osdmap.require_osd_release < ceph_release_t::octopus); pending_inc.new_removed_snaps[m->pool].insert(m->snapid); + // also record the new seq as purged: this avoids a discontinuity + // after all of the snaps have been purged, since the seq assigned + // during removal lives in the same namespace as the actual snaps. + pending_pseudo_purged_snaps[m->pool].insert(pp.get_snap_seq()); changed = true; } break; diff --git a/src/mon/OSDMonitor.h b/src/mon/OSDMonitor.h index 0346aa2cb2b8..896f4ee7f63c 100644 --- a/src/mon/OSDMonitor.h +++ b/src/mon/OSDMonitor.h @@ -221,6 +221,7 @@ public: map failure_info; map down_pending_out; // osd down -> out bool priority_convert = false; + map> pending_pseudo_purged_snaps; map osd_weight;