]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mon/OSDMonitor: fix lookup_purged_snap implementation
authorSage Weil <sage@redhat.com>
Fri, 7 Jun 2019 15:23:18 +0000 (10:23 -0500)
committerSage Weil <sage@redhat.com>
Tue, 2 Jul 2019 13:37:50 +0000 (08:37 -0500)
- look at purged, not removed snap keys
- fix the key check to look at the *key name* prefix, not the overall
  prefix (the one implemented by the KeyValueDB interface).

Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/OSDMonitor.cc

index 1bd941129d633386fc590413e30999816c0c193a..6fba3718ab3247df0a5b0049a2517f7bc1973ce6 100644 (file)
@@ -6257,13 +6257,18 @@ string OSDMonitor::make_snap_purged_key_value(
 int OSDMonitor::lookup_purged_snap(int64_t pool, snapid_t snap,
                                   snapid_t *begin, snapid_t *end)
 {
-  string k = make_snap_key(pool, snap);
+  string k = make_snap_purged_key(pool, snap);
   auto it = mon->store->get_iterator(OSD_SNAP_PREFIX);
   it->lower_bound(k);
   if (!it->valid()) {
+    dout(20) << __func__ << " pool " << pool << " snap " << snap
+            << " - key '" << k << "' not found" << dendl;
     return -ENOENT;
   }
-  if (it->key().find(OSD_SNAP_PREFIX) != 0) {
+  if (it->key().find("purged_snap_") != 0) {
+    dout(20) << __func__ << " pool " << pool << " snap " << snap
+            << " - key '" << k << "' got '" << it->key()
+            << "', wrong prefix" << dendl;
     return -ENOENT;
   }
   bufferlist v = it->value();
@@ -6271,6 +6276,9 @@ int OSDMonitor::lookup_purged_snap(int64_t pool, snapid_t snap,
   decode(*begin, p);
   decode(*end, p);
   if (snap < *begin || snap >= *end) {
+    dout(20) << __func__ << " pool " << pool << " snap " << snap
+            << " - found [" << *begin << "," << *end << "), no overlap"
+            << dendl;
     return -ENOENT;
   }
   return 0;