From: Sage Weil Date: Tue, 20 Jun 2017 18:25:28 +0000 (-0400) Subject: ceph-objectstore-tool: do not populate snapmapper with missing clones X-Git-Tag: v12.1.0~23^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=867ada5bd577cf25a6e40db340f0c3bb9d408f3c;p=ceph.git ceph-objectstore-tool: do not populate snapmapper with missing clones Cache pools may have clones represented in SnapSet that are not stored locally. This is fine as long as ceph-objectstore-tool doesn't go and add them when it shouldn't. Fixes: http://tracker.ceph.com/issues/19943 Signed-off-by: Sage Weil --- diff --git a/src/tools/ceph_objectstore_tool.cc b/src/tools/ceph_objectstore_tool.cc index 23e06ecf04e6..9fcbbdf3e145 100644 --- a/src/tools/ceph_objectstore_tool.cc +++ b/src/tools/ceph_objectstore_tool.cc @@ -861,14 +861,24 @@ int get_attrs( cout << "snapset " << snapset << std::endl; if (!snapset.is_legacy()) { for (auto& p : snapset.clone_snaps) { - hobject_t clone = hoid.hobj; - clone.snap = p.first; + ghobject_t clone = hoid; + clone.hobj.snap = p.first; set snaps(p.second.begin(), p.second.end()); + if (!store->exists(coll, clone)) { + // no clone, skip. this is probably a cache pool. this works + // because we use a separate transaction per object and clones + // come before head in the archive. + if (debug) + cerr << "\tskipping missing " << clone << " (snaps " + << snaps << ")" << std::endl; + continue; + } if (debug) - cerr << "\tsetting " << clone << " snaps " << snaps << std::endl; + cerr << "\tsetting " << clone.hobj << " snaps " << snaps + << std::endl; OSDriver::OSTransaction _t(driver.get_transaction(t)); assert(!snaps.empty()); - snap_mapper.add_oid(clone, snaps, &_t); + snap_mapper.add_oid(clone.hobj, snaps, &_t); } } } else {