]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: trim dups regardless of their versions
authorRadosław Zarzyński <rzarzyns@redhat.com>
Wed, 15 Jun 2022 15:19:30 +0000 (17:19 +0200)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Thu, 8 Sep 2022 16:44:39 +0000 (22:14 +0530)
Fixes: https://tracker.ceph.com/issues/53729
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
(cherry picked from commit aada08acde7a05ad769bb7a886ebcece628d522c)
(cherry picked from commit 9461ab0bd447ba8a4e05d59841b4aaff1951a7f3)

Resolves: rhbz#2093106

src/osd/PGLog.cc

index d7ab12c01dfa269ab18f7110876625f40749c693..c61e819f9081826f5caf4559e80a8f4f9a2baf39 100644 (file)
@@ -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());