]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd/scrub: scanning the rollbacks not mandating a reschedule wip-rf-fastrolls
authorRonen Friedman <rfriedma@redhat.com>
Sat, 4 Oct 2025 16:58:40 +0000 (11:58 -0500)
committerRonen Friedman <rfriedma@redhat.com>
Sat, 4 Oct 2025 16:58:40 +0000 (11:58 -0500)
The scrubber calls PG::_scan_rollback_obs() to clean up obsolete
rollback objects. This function may queue a transaction to
delete such objects.

The commit modifies the scrubber, so that no rescheduling of
the scrub is mandated if no transaction was queued.

Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
src/osd/PG.cc
src/osd/PG.h
src/osd/scrubber/pg_scrubber.cc

index 46e97f24e79248dfdeabaee474a31ca669f6e682..8a9ebd43e6356219a3625c5d37494b6b86befe00 100644 (file)
@@ -1742,7 +1742,7 @@ void PG::unreserve_recovery_space() {
   local_num_bytes.store(0);
 }
 
-void PG::_scan_rollback_obs(const vector<ghobject_t> &rollback_obs)
+bool PG::_scan_rollback_obs(const vector<ghobject_t> &rollback_obs)
 {
   ObjectStore::Transaction t;
   eversion_t trimmed_to = recovery_state.get_last_rollback_info_trimmed_to_applied();
@@ -1763,7 +1763,9 @@ void PG::_scan_rollback_obs(const vector<ghobject_t> &rollback_obs)
     derr << __func__ << ": queueing trans to clean up obsolete rollback objs"
         << dendl;
     osd->store->queue_transaction(ch, std::move(t), NULL);
+    return true; // a transaction was queued
   }
+  return false;
 }
 
 
index 3bef1c8c5e4426bdd7efaa7da143517099694fe0..5914d6f5e2e7f59d3e455bf64ddc667b4242a7fa 100644 (file)
@@ -1227,7 +1227,15 @@ protected:
   [[nodiscard]] bool ops_blocked_by_scrub() const;
   [[nodiscard]] Scrub::scrub_prio_t is_scrub_blocking_ops() const;
 
-  void _scan_rollback_obs(const std::vector<ghobject_t> &rollback_obs);
+
+  /**
+   * Scan the given list of rollback objects for obsolete entries.
+   * If found - the obsolete entries are removed.
+   *
+   * @return 'true' if a transaction was issued.
+   */
+  bool _scan_rollback_obs(const std::vector<ghobject_t> &rollback_obs);
+
   /**
    * returns true if [begin, end) is good to scrub at this time
    * a false return value obliges the implementer to requeue scrub when the
index eb9c0c697e373490f3ccc9f74efd8e41eb68a086..be7236606d3d8d5a5c35adf58b7326319f7a1e94 100644 (file)
@@ -1376,9 +1376,13 @@ int PgScrubber::build_scrub_map_chunk(ScrubMap& map,
     if (pos.ls.empty()) {
       break;
     }
-    m_pg->_scan_rollback_obs(rollback_obs);
     pos.pos = 0;
-    return -EINPROGRESS;
+    if (m_pg->_scan_rollback_obs(rollback_obs)) {
+      // we had to perform some real work (queue a transaction
+      // to discard obsolete rollback versions of objects in the
+      // selected range). Let's reschedule the scrub.
+      return -EINPROGRESS;
+    }
   }
 
   // scan objects