Skip to content

Commit e618dc0

Browse files
committed
osd/ECBackend.cc: Fix double increment of num_shards_repaired stat
Commit ceph@deffa82 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 <[email protected]>
1 parent 679f382 commit e618dc0

File tree

1 file changed

+14
-22
lines changed

1 file changed

+14
-22
lines changed

src/osd/ECBackend.cc

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -229,28 +229,20 @@ void ECBackend::handle_recovery_push(
229229

230230
recovery_backend.handle_recovery_push(op, m, is_repair);
231231

232-
if (op.after_progress.data_complete) {
233-
if ((get_parent()->pgb_is_primary())) {
234-
if (get_parent()->pg_is_repair() || is_repair)
235-
get_parent()->inc_osd_stat_repaired();
236-
} else {
237-
// If primary told us this is a repair, bump osd_stat_t::num_objects_repaired
238-
if (is_repair)
239-
get_parent()->inc_osd_stat_repaired();
240-
if (get_parent()->pg_is_remote_backfilling()) {
241-
struct stat st;
242-
int r = store->stat(ch, ghobject_t(op.soid, ghobject_t::NO_GEN,
243-
get_parent()->whoami_shard().shard), &st);
244-
if (r == 0) {
245-
get_parent()->pg_sub_local_num_bytes(st.st_size);
246-
// XXX: This can be way overestimated for small objects
247-
get_parent()->pg_sub_num_bytes(st.st_size * get_ec_data_chunk_count());
248-
dout(10) << __func__ << " " << op.soid
249-
<< " sub actual data by " << st.st_size
250-
<< " sub num_bytes by " << st.st_size * get_ec_data_chunk_count()
251-
<< dendl;
252-
}
253-
}
232+
if (op.after_progress.data_complete &&
233+
!(get_parent()->pgb_is_primary()) &&
234+
get_parent()->pg_is_remote_backfilling()) {
235+
struct stat st;
236+
int r = store->stat(ch, ghobject_t(op.soid, ghobject_t::NO_GEN,
237+
get_parent()->whoami_shard().shard), &st);
238+
if (r == 0) {
239+
get_parent()->pg_sub_local_num_bytes(st.st_size);
240+
// XXX: This can be way overestimated for small objects
241+
get_parent()->pg_sub_num_bytes(st.st_size * get_ec_data_chunk_count());
242+
dout(10) << __func__ << " " << op.soid
243+
<< " sub actual data by " << st.st_size
244+
<< " sub num_bytes by " << st.st_size * get_ec_data_chunk_count()
245+
<< dendl;
254246
}
255247
}
256248
}

0 commit comments

Comments
 (0)