}
// finish
- dout(20) << __func__ << " finishing" << dendl;
ceph_assert(pos.done());
- repair_oinfo_oid(map);
-
- dout(20) << __func__ << " done, got " << map.objects.size() << " items"
- << dendl;
+ dout(20) << fmt::format("{}: done. {} objects in scrub-map", __func__,
+ map.objects.size())
+ << dendl;
return 0;
}
-/// \todo consider moving repair_oinfo_oid() back to the backend
-void PgScrubber::repair_oinfo_oid(ScrubMap& smap)
-{
- for (auto i = smap.objects.rbegin(); i != smap.objects.rend(); ++i) {
-
- const hobject_t& hoid = i->first;
- ScrubMap::object& o = i->second;
-
- if (o.attrs.find(OI_ATTR) == o.attrs.end()) {
- continue;
- }
- object_info_t oi;
- try {
- oi.decode(o.attrs[OI_ATTR]);
- } catch (...) {
- continue;
- }
-
- if (oi.soid != hoid) {
- ObjectStore::Transaction t;
- OSDriver::OSTransaction _t(m_pg->osdriver.get_transaction(&t));
-
- m_osds->clog->error()
- << "osd." << m_pg_whoami << " found object info error on pg " << m_pg_id
- << " oid " << hoid << " oid in object info: " << oi.soid
- << "...repaired";
- // Fix object info
- oi.soid = hoid;
- bufferlist bl;
- encode(oi,
- bl,
- m_pg->get_osdmap()->get_features(CEPH_ENTITY_TYPE_OSD, nullptr));
-
- o.attrs[OI_ATTR] = std::move(bl);
-
- t.setattr(m_pg->coll, ghobject_t(hoid), OI_ATTR, bl);
- int r = m_pg->osd->store->queue_transaction(m_pg->ch, std::move(t));
- if (r != 0) {
- derr << __func__ << ": queue_transaction got " << cpp_strerror(r)
- << dendl;
- }
- }
- }
-}
-
void PgScrubber::run_callbacks()
{
epoch_t m_interval_start{0}; ///< interval's 'from' of when scrubbing was
///< first scheduled
- void repair_oinfo_oid(ScrubMap& smap);
-
/*
* the exact epoch when the scrubbing actually started (started here - cleared
* checks for no-scrub conf). Incoming events are verified against this, with
return shard_as_auth_t{errstream.str()};
}
}
- }
- // This is automatically corrected in repair_oinfo_oid()
- ceph_assert(oi.soid == obj);
+ if (!dup_error_cond(err,
+ false,
+ (oi.soid != obj),
+ shard_info,
+ &shard_info_wrapper::set_info_corrupted,
+ "candidate info oid mismatch"sv,
+ errstream)) {
+ return shard_as_auth_t{errstream.str()};
+ }
+ }
if (test_error_cond(smap_obj.size != logical_to_ondisk_size(oi.size),
shard_info,