From fe3ec8be7b7017392b68b9a62f6dd412d8591450 Mon Sep 17 00:00:00 2001 From: Ronen Friedman Date: Tue, 8 Feb 2022 16:09:19 +0000 Subject: [PATCH] osd/scrub: fix some scrubber-backend formatting no code changes. Signed-off-by: Ronen Friedman --- src/osd/PG.h | 12 ++-- src/osd/scrubber/pg_scrubber.cc | 2 +- src/osd/scrubber/scrub_backend.cc | 96 +++++++++++++++---------------- 3 files changed, 53 insertions(+), 57 deletions(-) diff --git a/src/osd/PG.h b/src/osd/PG.h index 4cd845d43161e..f7266e4739c6b 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -306,12 +306,12 @@ public: stats.objects_scrubbed = 0; } - void reset_objects_scrubbed() { - recovery_state.update_stats( - [=](auto &history, auto &stats) { - reset_objects_scrubbed(stats); - return true; - }); + void reset_objects_scrubbed() + { + recovery_state.update_stats([=](auto& history, auto& stats) { + reset_objects_scrubbed(stats); + return true; + }); } bool is_deleting() const { diff --git a/src/osd/scrubber/pg_scrubber.cc b/src/osd/scrubber/pg_scrubber.cc index f1f0e295be0a0..08afd79a7c2bd 100644 --- a/src/osd/scrubber/pg_scrubber.cc +++ b/src/osd/scrubber/pg_scrubber.cc @@ -1630,7 +1630,7 @@ void PgScrubber::scrub_finish() static_cast(m_pg->cct->_conf->osd_scrub_auto_repair_num_errors)) { dout(10) << __func__ << " undoing the repair" << dendl; - state_clear(PG_STATE_REPAIR); // not expected to be set, anyway + state_clear(PG_STATE_REPAIR); // not expected to be set, anyway m_is_repair = false; update_op_mode_text(); } diff --git a/src/osd/scrubber/scrub_backend.cc b/src/osd/scrubber/scrub_backend.cc index 0a724e8dc7b3f..505428960aed5 100644 --- a/src/osd/scrubber/scrub_backend.cc +++ b/src/osd/scrubber/scrub_backend.cc @@ -386,25 +386,24 @@ int ScrubBackend::scrub_process_inconsistent() for (const auto& [hobj, shrd_list] : m_auth_peers) { - auto missing_entry = m_missing.find(hobj); + auto missing_entry = m_missing.find(hobj); - if (missing_entry != m_missing.end()) { - repair_object(hobj, shrd_list, missing_entry->second); - fixed_cnt += missing_entry->second.size(); - } + if (missing_entry != m_missing.end()) { + repair_object(hobj, shrd_list, missing_entry->second); + fixed_cnt += missing_entry->second.size(); + } - if (m_inconsistent.count(hobj)) { - repair_object(hobj, shrd_list, m_inconsistent[hobj]); - fixed_cnt += m_inconsistent[hobj].size(); - } + if (m_inconsistent.count(hobj)) { + repair_object(hobj, shrd_list, m_inconsistent[hobj]); + fixed_cnt += m_inconsistent[hobj].size(); } + } return fixed_cnt; } -void ScrubBackend::repair_object( - const hobject_t& soid, - const auth_peers_t& ok_peers, - const set& bad_peers) +void ScrubBackend::repair_object(const hobject_t& soid, + const auth_peers_t& ok_peers, + const set& bad_peers) { if (g_conf()->subsys.should_gather()) { // log the good peers @@ -506,9 +505,9 @@ auth_selection_t ScrubBackend::select_auth_object(const hobject_t& ho, << dendl; } - dout(20) << fmt::format( - "{}: {} shard {} got:{:D}", __func__, ho, l, shard_ret) - << dendl; + dout(20) + << fmt::format("{}: {} shard {} got:{:D}", __func__, ho, l, shard_ret) + << dendl; if (shard_ret.possible_auth == shard_as_auth_t::usable_t::not_usable) { @@ -542,11 +541,11 @@ auth_selection_t ScrubBackend::select_auth_object(const hobject_t& ho, dcount(shard_ret.oi) > dcount(ret_auth.auth_oi))) { dout(30) << fmt::format("{}: using {} moved auth oi {:p} <-> {:p}", - __func__, - l, - (void*)&ret_auth.auth_oi, - (void*)&shard_ret.oi) - << dendl; + __func__, + l, + (void*)&ret_auth.auth_oi, + (void*)&shard_ret.oi) + << dendl; ret_auth.auth = shard_ret.auth_iter; ret_auth.auth_shard = ret_auth.auth->first; @@ -702,13 +701,13 @@ shard_as_auth_t ScrubBackend::possible_auth_shard(const hobject_t& obj, } } else { // debug@dev only - dout(30) - << fmt::format("{} missing snap addr: {:p} shard_info: {:p} er: {:x}", - __func__, - (void*)&smap_obj, - (void*)&shard_info, - shard_info.errors) - << dendl; + dout(30) << fmt::format( + "{} missing snap addr: {:p} shard_info: {:p} er: {:x}", + __func__, + (void*)&smap_obj, + (void*)&shard_info, + shard_info.errors) + << dendl; } } @@ -817,7 +816,8 @@ void ScrubBackend::compare_smaps() }); } -std::optional ScrubBackend::compare_obj_in_maps(const hobject_t& ho) +std::optional ScrubBackend::compare_obj_in_maps( + const hobject_t& ho) { // clear per-object data: this_chunk->cur_inconsistent.clear(); @@ -836,10 +836,12 @@ std::optional ScrubBackend::compare_obj_in_maps(const hobject_t& ho if (!auth_res.is_auth_available) { // no auth selected object_error.set_version(0); - object_error.set_auth_missing( - ho, this_chunk->received_maps, auth_res.shard_map, - this_chunk->m_error_counts.shallow_errors, - this_chunk->m_error_counts.deep_errors, m_pg_whoami); + object_error.set_auth_missing(ho, + this_chunk->received_maps, + auth_res.shard_map, + this_chunk->m_error_counts.shallow_errors, + this_chunk->m_error_counts.deep_errors, + m_pg_whoami); if (object_error.has_deep_errors()) { this_chunk->m_error_counts.deep_errors++; @@ -876,8 +878,11 @@ std::optional ScrubBackend::compare_obj_in_maps(const hobject_t& ho // At this point auth_list is populated, so we add the object error // shards as inconsistent. - inconsistents( - ho, auth_object, auth_res.auth_oi, std::move(*opt_ers), errstream); + inconsistents(ho, + auth_object, + auth_res.auth_oi, + std::move(*opt_ers), + errstream); } else { // both the auth & errs containers are empty @@ -1548,11 +1553,8 @@ void ScrubBackend::scrub_snapshot_metadata(ScrubMap& map) // Log any clones we were expecting to be there up to target // This will set missing, but will be a no-op if snap.soid == *curclone. - missing += process_clones_to(head, - snapset, - target, - &curclone, - head_error); + missing += + process_clones_to(head, snapset, target, &curclone, head_error); } bool expected; @@ -1591,9 +1593,7 @@ void ScrubBackend::scrub_snapshot_metadata(ScrubMap& map) if (soid.has_snapset()) { if (missing) { - log_missing(missing, - head, - __func__); + log_missing(missing, head, __func__); } // Save previous head error information @@ -1720,11 +1720,8 @@ void ScrubBackend::scrub_snapshot_metadata(ScrubMap& map) dout(10) << __func__ << " " << m_mode_desc << " " << m_pg_id << " No more objects while processing " << *head << dendl; - missing += process_clones_to(head, - snapset, - all_clones, - &curclone, - head_error); + missing += + process_clones_to(head, snapset, all_clones, &curclone, head_error); } // There could be missing found by the test above or even @@ -1846,7 +1843,6 @@ std::vector ScrubBackend::scan_snaps( if (maybe_fix_order) { out_orders.push_back(std::move(*maybe_fix_order)); } - } } @@ -1878,7 +1874,7 @@ std::optional ScrubBackend::scan_object_snaps( if (r == -ENOENT || cur_snaps != obj_snaps) { // add this object to the list of snapsets that needs fixing. Note - // that we also collect the existing (bogus) list, as legacy log lines show those + // that we also collect the existing (bogus) list, for logging purposes snap_mapper_op_t fixing_op = (r == -ENOENT ? snap_mapper_op_t::add : snap_mapper_op_t::update); return snap_mapper_fix_t{fixing_op, hoid, obj_snaps, cur_snaps}; -- 2.39.5