From fef969b0add85d6915f5616fde2cfd8ce3b702c1 Mon Sep 17 00:00:00 2001 From: Bill Scales Date: Mon, 23 Jun 2025 11:36:37 +0100 Subject: [PATCH] mon: Optimized EC clean_temps needs to permit primary change Optimized EC pools were blocking clean_temps from clearing pg_temp when up == acting but up_primary != acting_primary because optimized pools sometimes use pg_temp to force a change of primary shard. However this can block merges which require the two PGs being merged to have the same primary. Relax clean_temps to permit pg_temp to be cleared so long as the new primary is not a non-primary shard. Signed-off-by: Bill Scales (cherry picked from commit ce53276191e60375486f75d93508690f780bee21) --- src/osd/OSDMap.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index 714f5c41977..4030507ac3f 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -2034,9 +2034,17 @@ void OSDMap::clean_temps(CephContext *cct, // force a change of primary shard - do not remove pg_temp // if it is being used for this purpose if (pool->allows_ecoptimizations()) { - if (nextmap._pick_primary(pg.second) != primary) { - // pg_temp still required - keep = true; + // primary might not be in raw_up - so keep pg_temp unless + // proven that the primary is not a non-primary shard + keep = true; + for (unsigned int i = 0; i < raw_up.size(); ++i) { + if (raw_up[i] == primary) { + if (!pool->is_nonprimary_shard(shard_id_t(i))) { + // pg_temp not required + keep = false; + } + break; + } } } if (!keep) { -- 2.39.5