]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/SnapMapper: remove pre-octopus snapmapper keys after conversion 30368/head
authorSage Weil <sage@redhat.com>
Thu, 12 Sep 2019 21:58:02 +0000 (16:58 -0500)
committerSage Weil <sage@redhat.com>
Thu, 12 Sep 2019 21:58:55 +0000 (16:58 -0500)
We don't need to keep these around (forever) unless we are paranoid the
conversion won't work for some reason, but I don't think we need to
worry about that.

Thanks to rmkeyrange, this is always fast and easy!

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

index d61b43decc610844163b2412df4d55caa1bed886..b6300b7f280d05d3687c01c1d04e41bd648fc7ac 100644 (file)
@@ -701,6 +701,17 @@ int SnapMapper::convert_legacy(
 
   dout(1) << __func__ << " converted " << n << " keys in "
          << timespan_str(end - start) << dendl;
-#warning fixme remove old keys
+
+  // remove the old keys
+  {
+    ObjectStore::Transaction t;
+    string end = SnapMapper::LEGACY_MAPPING_PREFIX;
+    ++end[end.size()-1]; // turn _ to whatever comes after _
+    t.omap_rmkeyrange(ch->cid, hoid,
+                     SnapMapper::LEGACY_MAPPING_PREFIX,
+                     end);
+    int r = store->queue_transaction(ch, std::move(t));
+    ceph_assert(r == 0);
+  }
   return 0;
 }