]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: EC optimizations overaggresive check for missing objects
authorBill Scales <bill_scales@uk.ibm.com>
Mon, 26 May 2025 13:33:12 +0000 (14:33 +0100)
committerAlex Ainscow <aainscow@uk.ibm.com>
Tue, 1 Jul 2025 12:03:29 +0000 (13:03 +0100)
Relax an assert in read_log_and_missing for optimized EC
pools. Because the log may not have entries for partial
writes but the missing list is calculated from the full
log the need version for a missing item may be newer than
the lastest log entry for that object.

ceph_objectstore_tool needs care because we don't want to add
extra dependencies. To minimise the dependencies, we always
relax the asserts when using this tool.

Signed-off-by: Bill Scales <bill_scales@uk.ibm.com>
Signed-off-by: Alex Ainscow <aainscow@uk.ibm.com>
src/osd/PG.cc
src/osd/PGLog.h
src/test/osd/TestPGLog.cc
src/tools/ceph_objectstore_tool.cc

index 069a16200f5589835843ede86f47b51265804db5..46e97f24e79248dfdeabaee474a31ca669f6e682 100644 (file)
@@ -1102,6 +1102,7 @@ void PG::read_state(ObjectStore *store)
        info,
        oss,
        cct->_conf->osd_ignore_stale_divergent_priors,
+       pool.info.allows_ecoptimizations(),
        cct->_conf->osd_debug_verify_missing_on_start);
 
       if (oss.tellp())
index 645eefcba991669f4b2be669a0bd30d4d8506d02..90f123993c3f6af12929915bea88104881023126 100644 (file)
@@ -1512,12 +1512,14 @@ public:
     const pg_info_t &info,
     std::ostringstream &oss,
     bool tolerate_divergent_missing_log,
+    bool ec_optimizations_enabled, // Relax asserts for partial writes
     bool debug_verify_stored_missing = false
     ) {
     return read_log_and_missing(
       cct, store, ch, pgmeta_oid, info,
       log, missing, oss,
       tolerate_divergent_missing_log,
+      ec_optimizations_enabled,
       &clear_divergent_priors,
       this,
       (pg_log_debug ? &log_keys_debug : nullptr),
@@ -1535,6 +1537,7 @@ public:
     missing_type &missing,
     std::ostringstream &oss,
     bool tolerate_divergent_missing_log,
+    bool ec_optimizations_enabled, // Relax asserts for partial writes
     bool *clear_divergent_priors = nullptr,
     const DoutPrefixProvider *dpp = nullptr,
     std::set<std::string> *log_keys_debug = nullptr,
@@ -1657,6 +1660,7 @@ public:
            continue;
          if (!i->is_written_shard(info.pgid.shard)) {
            // optimized EC - partial write that this shard didn't participate in
+           ceph_assert(ec_optimizations_enabled);
            continue;
          }
          if (did.count(i->soid)) continue;
@@ -1700,7 +1704,15 @@ public:
                        miter->second.have == eversion_t()));
              } else {
                ceph_assert(miter != missing.get_items().end());
-               ceph_assert(miter->second.need == i->version);
+               if (ec_optimizations_enabled) {
+                 // Optimized pools do not store log entries for shards that
+                 // did not participate in the write, however missing entries
+                 // are calculated from full log so may be for a newer version
+                 // that the latest log entry
+                 ceph_assert(miter->second.need >= i->version);
+               } else {
+                 ceph_assert(miter->second.need == i->version);
+               }
                ceph_assert(miter->second.have == eversion_t());
              }
              checked.insert(i->soid);
index ff275b92bc635659eb1a96cd0266f4e24d7abaef..0f85e445cc0e464456a1137f333709efacd03281 100644 (file)
@@ -2487,7 +2487,7 @@ public:
     clear();
     ostringstream err;
     read_log_and_missing(store.get(), ch, log_oid,
-                        pg_info_t(), err, false);
+                        pg_info_t(), err, false, false);
     ASSERT_EQ(orig_dups.size(), log.dups.size());
     ASSERT_EQ(orig_dups, log.dups);
     auto dups_it = log.dups.begin();
index 95fc83d56320430e55e9f20f5f28803c3c5f8f10..ad4d709488ef5fee29cf25d6007c50d32fd268c4 100644 (file)
@@ -453,7 +453,8 @@ int get_log(CephContext *cct, ObjectStore *fs, __u8 struct_ver,
       pgid.make_pgmeta_oid(),
       info, log, missing,
       oss,
-      g_ceph_context->_conf->osd_ignore_stale_divergent_priors);
+      g_ceph_context->_conf->osd_ignore_stale_divergent_priors,
+      true); // Always use relaxed asserts for this tool.
     if (debug && oss.str().size())
       cerr << oss.str() << std::endl;
   }
@@ -1173,6 +1174,7 @@ int expand_log(
       info,
       oss,
       cct->_conf->osd_ignore_stale_divergent_priors,
+      true, // Always use relaxed asserts for this tool.
       cct->_conf->osd_debug_verify_missing_on_start);
     if (debug && oss.str().size())
       cerr << oss.str() << std::endl;