mirror of
https://github.com/ceph/ceph
synced 2025-01-15 15:32:45 +00:00
ceph-objectstore-tool: drop pre-snapset support for setting up snapmapper
Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
parent
c6275e7d4d
commit
e4c4942467
@ -835,60 +835,38 @@ int get_attrs(
|
||||
|
||||
// This could have been handled in the caller if we didn't need to
|
||||
// support exports that didn't include object_info_t in object_begin.
|
||||
if (hoid.generation == ghobject_t::NO_GEN) {
|
||||
if (hoid.hobj.snap < CEPH_MAXSNAP) {
|
||||
map<string,bufferlist>::iterator mi = as.data.find(OI_ATTR);
|
||||
if (mi != as.data.end()) {
|
||||
object_info_t oi(mi->second);
|
||||
|
||||
if (debug)
|
||||
cerr << "object_info " << oi << std::endl;
|
||||
|
||||
OSDriver::OSTransaction _t(driver.get_transaction(t));
|
||||
set<snapid_t> oi_snaps(oi.legacy_snaps.begin(), oi.legacy_snaps.end());
|
||||
if (!oi_snaps.empty()) {
|
||||
if (hoid.generation == ghobject_t::NO_GEN &&
|
||||
hoid.hobj.is_head()) {
|
||||
map<string,bufferlist>::iterator mi = as.data.find(SS_ATTR);
|
||||
if (mi != as.data.end()) {
|
||||
SnapSet snapset;
|
||||
auto p = mi->second.begin();
|
||||
snapset.decode(p);
|
||||
cout << "snapset " << snapset << std::endl;
|
||||
for (auto& p : snapset.clone_snaps) {
|
||||
ghobject_t clone = hoid;
|
||||
clone.hobj.snap = p.first;
|
||||
set<snapid_t> 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 << "\tsetting legacy snaps " << oi_snaps << std::endl;
|
||||
snap_mapper.add_oid(hoid.hobj, oi_snaps, &_t);
|
||||
cerr << "\tskipping missing " << clone << " (snaps "
|
||||
<< snaps << ")" << std::endl;
|
||||
continue;
|
||||
}
|
||||
if (debug)
|
||||
cerr << "\tsetting " << clone.hobj << " snaps " << snaps
|
||||
<< std::endl;
|
||||
OSDriver::OSTransaction _t(driver.get_transaction(t));
|
||||
assert(!snaps.empty());
|
||||
snap_mapper.add_oid(clone.hobj, snaps, &_t);
|
||||
}
|
||||
} else {
|
||||
if (hoid.hobj.is_head()) {
|
||||
map<string,bufferlist>::iterator mi = as.data.find(SS_ATTR);
|
||||
if (mi != as.data.end()) {
|
||||
SnapSet snapset;
|
||||
auto p = mi->second.begin();
|
||||
snapset.decode(p);
|
||||
cout << "snapset " << snapset << std::endl;
|
||||
if (!snapset.is_legacy()) {
|
||||
for (auto& p : snapset.clone_snaps) {
|
||||
ghobject_t clone = hoid;
|
||||
clone.hobj.snap = p.first;
|
||||
set<snapid_t> 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.hobj << " snaps " << snaps
|
||||
<< std::endl;
|
||||
OSDriver::OSTransaction _t(driver.get_transaction(t));
|
||||
assert(!snaps.empty());
|
||||
snap_mapper.add_oid(clone.hobj, snaps, &_t);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cerr << "missing SS_ATTR on " << hoid << std::endl;
|
||||
}
|
||||
}
|
||||
cerr << "missing SS_ATTR on " << hoid << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user