Skip to content

Commit b178ce4

Browse files
JonBailey1993aainscow
authored andcommitted
osd: Invalidate stats during peering if we are rolling a shard forwards.
This change will mean we always recalculate stats upon rolling stats forwards. This prevent the situation where we end up with incorrect statistics due to where we always take the stats of the oldest shard during peering; causing outdated pg stats being applied for cases where the oldest shards are shards that don't see partial writes where num_bytes has changed on other places after that point on that shard. Signed-off-by: Jon Bailey <[email protected]>
1 parent 2ee1884 commit b178ce4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/osd/PeeringState.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3333,6 +3333,9 @@ void PeeringState::proc_master_log(
33333333
apply_pwlc(info.partial_writes_last_complete[from.shard], from, oinfo,
33343334
&olog);
33353335
}
3336+
3337+
bool invalidate_stats = false;
3338+
33363339
// For partial writes we may be able to keep some of the divergent entries
33373340
if (olog.head < pg_log.get_head()) {
33383341
// Iterate backwards to divergence
@@ -3410,6 +3413,7 @@ void PeeringState::proc_master_log(
34103413
// This entry can be kept, only shards that didn't participate in
34113414
// the partial write missed the update
34123415
psdout(20) << "keeping entry " << p->version << dendl;
3416+
invalidate_stats = true;
34133417
eversion_t previous_version;
34143418
if (p == pg_log.get_log().log.begin()) {
34153419
previous_version = pg_log.get_tail();
@@ -3427,6 +3431,7 @@ void PeeringState::proc_master_log(
34273431
// log to be authoritative (i.e., their entries are by definitely
34283432
// non-divergent).
34293433
merge_log(t, oinfo, std::move(olog), from);
3434+
info.stats.stats_invalid |= invalidate_stats;
34303435
peer_info[from] = oinfo;
34313436
psdout(10) << " peer osd." << from << " now " << oinfo
34323437
<< " " << omissing << dendl;

0 commit comments

Comments
 (0)