Skip to content

Commit 9cccb68

Browse files
committed
osd/scrub: scanning the rollbacks not mandating a reschedule
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. Fixes: https://tracker.ceph.com/issues/73773 Signed-off-by: Ronen Friedman <[email protected]>
1 parent afa88a4 commit 9cccb68

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

src/osd/PG.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1743,7 +1743,7 @@ void PG::unreserve_recovery_space() {
17431743
local_num_bytes.store(0);
17441744
}
17451745

1746-
void PG::_scan_rollback_obs(const vector<ghobject_t> &rollback_obs)
1746+
bool PG::_scan_rollback_obs(const vector<ghobject_t> &rollback_obs)
17471747
{
17481748
ObjectStore::Transaction t;
17491749
eversion_t trimmed_to = recovery_state.get_last_rollback_info_trimmed_to_applied();
@@ -1764,7 +1764,9 @@ void PG::_scan_rollback_obs(const vector<ghobject_t> &rollback_obs)
17641764
derr << __func__ << ": queueing trans to clean up obsolete rollback objs"
17651765
<< dendl;
17661766
osd->store->queue_transaction(ch, std::move(t), NULL);
1767+
return true; // a transaction was queued
17671768
}
1769+
return false;
17681770
}
17691771

17701772

src/osd/PG.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1228,7 +1228,15 @@ class PG : public DoutPrefixProvider,
12281228
[[nodiscard]] bool ops_blocked_by_scrub() const;
12291229
[[nodiscard]] Scrub::scrub_prio_t is_scrub_blocking_ops() const;
12301230

1231-
void _scan_rollback_obs(const std::vector<ghobject_t> &rollback_obs);
1231+
1232+
/**
1233+
* Scan the given list of rollback objects for obsolete entries.
1234+
* If found - the obsolete entries are removed.
1235+
*
1236+
* @return 'true' if a transaction was issued.
1237+
*/
1238+
bool _scan_rollback_obs(const std::vector<ghobject_t> &rollback_obs);
1239+
12321240
/**
12331241
* returns true if [begin, end) is good to scrub at this time
12341242
* a false return value obliges the implementer to requeue scrub when the

src/osd/scrubber/pg_scrubber.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,9 +1381,13 @@ int PgScrubber::build_scrub_map_chunk(ScrubMap& map,
13811381
if (pos.ls.empty()) {
13821382
break;
13831383
}
1384-
m_pg->_scan_rollback_obs(rollback_obs);
13851384
pos.pos = 0;
1386-
return -EINPROGRESS;
1385+
if (m_pg->_scan_rollback_obs(rollback_obs)) {
1386+
// we had to perform some real work (queue a transaction
1387+
// to discard obsolete rollback versions of objects in the
1388+
// selected range). Let's reschedule the scrub.
1389+
return -EINPROGRESS;
1390+
}
13871391
}
13881392

13891393
// scan objects

0 commit comments

Comments
 (0)