From aada08acde7a05ad769bb7a886ebcece628d522c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rados=C5=82aw=20Zarzy=C5=84ski?= Date: Wed, 15 Jun 2022 17:19:30 +0200 Subject: [PATCH] osd: trim dups regardless of their versions Fixes: https://tracker.ceph.com/issues/53729 Signed-off-by: Radoslaw Zarzynski --- src/osd/PGLog.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/osd/PGLog.cc b/src/osd/PGLog.cc index d7ab12c01df..c61e819f908 100644 --- a/src/osd/PGLog.cc +++ b/src/osd/PGLog.cc @@ -131,10 +131,18 @@ void PGLog::IndexedLog::trim( } } - while (!dups.empty()) { + // we can hit an inflated `dups` b/c of https://tracker.ceph.com/issues/53729 + // the idea is to slowly trim them over a prolonged period of time and mix + // omap deletes with writes (if we're here, a new log entry got added) to + // neither: 1) blow size of single Transaction nor 2) generate-n-accumulate + // large amount of tombstones in BlueStore's RocksDB. + // if trimming immediately is a must, then the ceph-objectstore-tool is + // the way to go. + const size_t max_dups = cct->_conf->osd_pg_log_dups_tracked; + for (size_t max_dups_to_trim = cct->_conf->osd_pg_log_trim_max; + max_dups_to_trim > 0 && dups.size() > max_dups; + max_dups_to_trim--) { const auto& e = *dups.begin(); - if (e.version.version >= earliest_dup_version) - break; lgeneric_subdout(cct, osd, 20) << "trim dup " << e << dendl; if (trimmed_dups) trimmed_dups->insert(e.get_key_name()); -- 2.39.5