From 3e000a5c6d9972a43113d3fa5b8bd5e5c3c478b6 Mon Sep 17 00:00:00 2001 From: Bill Scales Date: Wed, 19 Jun 2024 08:36:06 +0000 Subject: [PATCH] osd/ECBackend.cc: Fix double increment of num_shards_repaired stat Commit https://github.com/ceph/ceph/commit/deffa8209f9c0bd300cfdb54d358402bfc6e41c6 refactored ECBackend::handle_recovery_push for Crimson but accidentally duplicated the code that increments the num_shards_repaired OSD statistic. This caused one of the QA tests to fail because the stat reported twice as much repair work had been completed than expected: qa/standalone/scrub/osd-scrub-repair.sh: TEST_repair_stats_ec: test 26 = 13 Fixes: https://tracker.ceph.com/issues/64437 Signed-off-by: Bill Scales (cherry picked from commit e618dc01a7a1bdfaa3e1a6fa2a9a9ac13eee11b8) --- src/osd/ECBackend.cc | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/src/osd/ECBackend.cc b/src/osd/ECBackend.cc index fa3b895b2761a..cd312b8e02fda 100644 --- a/src/osd/ECBackend.cc +++ b/src/osd/ECBackend.cc @@ -229,28 +229,20 @@ void ECBackend::handle_recovery_push( recovery_backend.handle_recovery_push(op, m, is_repair); - if (op.after_progress.data_complete) { - if ((get_parent()->pgb_is_primary())) { - if (get_parent()->pg_is_repair() || is_repair) - get_parent()->inc_osd_stat_repaired(); - } else { - // If primary told us this is a repair, bump osd_stat_t::num_objects_repaired - if (is_repair) - get_parent()->inc_osd_stat_repaired(); - if (get_parent()->pg_is_remote_backfilling()) { - struct stat st; - int r = store->stat(ch, ghobject_t(op.soid, ghobject_t::NO_GEN, - get_parent()->whoami_shard().shard), &st); - if (r == 0) { - get_parent()->pg_sub_local_num_bytes(st.st_size); - // XXX: This can be way overestimated for small objects - get_parent()->pg_sub_num_bytes(st.st_size * get_ec_data_chunk_count()); - dout(10) << __func__ << " " << op.soid - << " sub actual data by " << st.st_size - << " sub num_bytes by " << st.st_size * get_ec_data_chunk_count() - << dendl; - } - } + if (op.after_progress.data_complete && + !(get_parent()->pgb_is_primary()) && + get_parent()->pg_is_remote_backfilling()) { + struct stat st; + int r = store->stat(ch, ghobject_t(op.soid, ghobject_t::NO_GEN, + get_parent()->whoami_shard().shard), &st); + if (r == 0) { + get_parent()->pg_sub_local_num_bytes(st.st_size); + // XXX: This can be way overestimated for small objects + get_parent()->pg_sub_num_bytes(st.st_size * get_ec_data_chunk_count()); + dout(10) << __func__ << " " << op.soid + << " sub actual data by " << st.st_size + << " sub num_bytes by " << st.st_size * get_ec_data_chunk_count() + << dendl; } } } -- 2.39.5