]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mon: Optimized EC clean_temps needs to permit primary change
authorBill Scales <bill_scales@uk.ibm.com>
Mon, 23 Jun 2025 10:36:37 +0000 (11:36 +0100)
committerJon <jonathan.bailey1@ibm.com>
Fri, 3 Oct 2025 13:31:23 +0000 (14:31 +0100)
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 <bill_scales@uk.ibm.com>
(cherry picked from commit ce53276191e60375486f75d93508690f780bee21)

src/osd/OSDMap.cc

index 714f5c41977e9f8c353ec04b4bf76f76c5d9907c..4030507ac3f0917f920c7095e30a9ec916ef3648 100644 (file)
@@ -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) {