From d4fff55c36731dae7f551c7bc7a0c8571f730e7e Mon Sep 17 00:00:00 2001 From: Bill Scales Date: Mon, 26 May 2025 14:33:12 +0100 Subject: [PATCH] osd: EC optimizations overaggresive check for missing objects 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 Signed-off-by: Alex Ainscow (cherry picked from commit 20e883fedaf19293e939c4cac44de196bd6c9c19) --- src/osd/PG.cc | 1 + src/osd/PGLog.h | 14 +++++++++++++- src/test/osd/TestPGLog.cc | 2 +- src/tools/ceph_objectstore_tool.cc | 4 +++- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 069a16200f5..46e97f24e79 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -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()) diff --git a/src/osd/PGLog.h b/src/osd/PGLog.h index 645eefcba99..90f123993c3 100644 --- a/src/osd/PGLog.h +++ b/src/osd/PGLog.h @@ -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 *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); diff --git a/src/test/osd/TestPGLog.cc b/src/test/osd/TestPGLog.cc index ff275b92bc6..0f85e445cc0 100644 --- a/src/test/osd/TestPGLog.cc +++ b/src/test/osd/TestPGLog.cc @@ -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(); diff --git a/src/tools/ceph_objectstore_tool.cc b/src/tools/ceph_objectstore_tool.cc index 95fc83d5632..ad4d709488e 100644 --- a/src/tools/ceph_objectstore_tool.cc +++ b/src/tools/ceph_objectstore_tool.cc @@ -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; -- 2.39.5