]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: record snap removal seq as purged
authorSage Weil <sage@redhat.com>
Thu, 20 Jun 2019 17:07:38 +0000 (12:07 -0500)
committerSage Weil <sage@redhat.com>
Tue, 2 Jul 2019 13:37:51 +0000 (08:37 -0500)
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 <sage@redhat.com>
src/mon/OSDMonitor.cc
src/mon/OSDMonitor.h

index fe82df4b769903d45a3fc5a95bc88d213ef5bf48..af8de92546bfa24c1ede7db17681ddd1717c7bf2 100644 (file)
@@ -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;
index 0346aa2cb2b8f8a87d2ec0fc8fd33ae50b240a31..896f4ee7f63c2a09d9c1bb26e85d723cccdff61d 100644 (file)
@@ -221,6 +221,7 @@ public:
   map<int, failure_info_t> failure_info;
   map<int,utime_t>    down_pending_out;  // osd down -> out
   bool priority_convert = false;
+  map<int64_t,set<snapid_t>> pending_pseudo_purged_snaps;
 
   map<int,double> osd_weight;