]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/ECBackend.cc: Fix double increment of num_shards_repaired stat 58266/head
authorBill Scales <bill_scales@uk.ibm.com>
Wed, 19 Jun 2024 08:36:06 +0000 (08:36 +0000)
committerAishwarya Mathuria <amathuri@redhat.com>
Tue, 25 Jun 2024 17:09:17 +0000 (22:39 +0530)
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 <bill_scales@uk.ibm.com>
(cherry picked from commit e618dc01a7a1bdfaa3e1a6fa2a9a9ac13eee11b8)

src/osd/ECBackend.cc

index fa3b895b2761aa160c2afd673ea89560a910ed2c..cd312b8e02fdad482fa04483fb842426a62b129c 100644 (file)
@@ -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;
     }
   }
 }