From 84567d3de32b430e78e1957e7224b8b48d1459d5 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 12 Sep 2019 16:58:02 -0500 Subject: [PATCH] osd/SnapMapper: remove pre-octopus snapmapper keys after conversion 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 --- src/osd/SnapMapper.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/osd/SnapMapper.cc b/src/osd/SnapMapper.cc index d61b43decc61..b6300b7f280d 100644 --- a/src/osd/SnapMapper.cc +++ b/src/osd/SnapMapper.cc @@ -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; } -- 2.47.3