storage: admit tiered_cloud partitions to space management#30993
storage: admit tiered_cloud partitions to space management#30993oleiman wants to merge 4 commits into
Conversation
879bfeb to
4a07020
Compare
|
/ci-repeat 1 |
4a07020 to
9ffde48
Compare
|
/ci-repeat 1 |
There was a problem hiding this comment.
Pull request overview
This PR updates the space-management (disk_space_manager) eviction path to include storage.mode=tiered_cloud partitions, enabling capacity-pressure driven local log reclamation that was previously gated out for tiered_cloud topics.
Changes:
- Admit tiered_cloud partitions into the eviction policy’s reclaimable-offset collection (in addition to legacy
remote_partition()topics). - Adjust
disk_log_implcloud-GC gates and_cloud_gc_offsethandling so tiered_cloud partitions can participate withoutdo_gcconsuming the pin, whilecompute_gc_offsetfolds and consumes the pin. - Add an rptest that validates tiered_cloud local footprint converges under capacity pressure and asserts
do_gcdoes not emit the “expected remote retention to be active” warning.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/rptest/tests/tiered_cloud_local_retention_test.py | Adds an end-to-end test covering capacity-pressure reclamation for tiered_cloud local logs and pin-consumption behavior. |
| src/v/storage/disk_log_impl.cc | Relaxes cloud-retention gates for tiered_cloud and updates _cloud_gc_offset consumption/interaction between do_gc and compute_gc_offset. |
| src/v/resource_mgmt/storage.cc | Includes tiered_cloud partitions when collecting reclaimable offsets for space management decisions. |
Review: admit
|
812a6ec to
0f4a98f
Compare
Review — storage: admit tiered_cloud partitions to space managementRead through the C++ and the new ducktape test. The change is coherent and the design holds together; leaving notes for the eventual un-draft. What the change does (as I read it)
Things worth confirming / following up (see inline)
Minor
Nothing blocking from a correctness standpoint; the main open item is the ctp_stm pin clear/refresh work you've already flagged. Since it's marked a draft/spike, this is calibrated accordingly. |
1bcb19f to
bc5740e
Compare
| _raft->last_snapshot_index() >= target | ||
| && _active_readers.empty()) { | ||
| _raft->last_snapshot_index() >= target && _active_readers.empty() | ||
| && !is_tiered) { |
There was a problem hiding this comment.
With && !is_tiered here, every tiered_cloud partition now falls into the bounded wait(retry_backoff_time) branch unconditionally, so an idle partition wakes and re-runs compute_local_retention_offset() every 5s forever (previously it could block untimed until _lro_advanced). The snapshot_and_truncate_log call is a cheap no-op when the target hasn't advanced (it early-returns on _last_snapshot_index >= eviction_point), so this is mostly the periodic recompute cost — but on a broker hosting many tiered_cloud partitions it's a non-trivial number of steady-state wakeups.
The root cause is that disk_space_manager sets the pin out of band without signalling _lro_advanced. A cleaner long-term fix would be for the eviction-policy install path / set_cloud_gc_offset to signal the stm so it could keep the untimed wait. Not blocking — worth a follow-up note.
ReviewSolid, well-scoped change. The core idea — introduce
Notes (all non-blocking, left inline)
TestsThe two new ducktape cases are well-constructed — Nice work — no correctness concerns from my read. |
CI test resultstest results on build#86687
test results on build#86727
test results on build#86736
|
|
@Lazin talked about this a little bit with Andrew earlier today. with regard to the |
| if (_cloud_gc_offset.has_value() && !is_cloud_gc_active()) { | ||
| std::ignore = consume_cloud_gc_offset(); | ||
| vlog(gclog.warn, "[{}] expected cloud GC to be active", config().ntp()); | ||
| co_return std::nullopt; |
There was a problem hiding this comment.
I think the clunker misunderstood the code here. This is not resetting the _cloud_gc_offset if it's set on a wrong type of log. It's the shortcut used by the space management. The _cloud_gc_offset is set by the disk space manager and then do_gc goes into this branch and requests eviction based on this offset exclusively. The code makes no sense given that the do_gc method can't be called for cloud topic partition.
There was a problem hiding this comment.
clunker misunderstood the code
nah that was all me 😅. would you settle for a vassert though? many paths through disk log impl, and calling do_gc for a tiered_cloud partition would certainly break prefix truncation in ctp_stm (and is a logic error, I think?).
There was a problem hiding this comment.
so I added the vassert and it immediately triggered in ducktape... added a blanket "skip housekeeping" check for cloud topics, but I'm not 100% sure that's the right shape. ptal
There was a problem hiding this comment.
the housekeeping loop is not supposed to run for both tsv2 and CT, so the blanket "skip housekeeping" sounds right
| /// (without resetting it -- that is do_gc's responsibility). | ||
| /// evict to. Usually derived from local retention, but when space | ||
| /// management has pinned _cloud_gc_offset that offset is returned instead. | ||
| /// The pin is not reset here; ctp_stm consumes it separately via |
There was a problem hiding this comment.
The offset should be reset after it's returned.
The compute_cloud_gc method is not a simple "getter" and it potentially mutates the state of the log. This is what the doc comment says:
/// via set_cloud_gc_offset. This is not a pure query -- it may mutate the
/// underlying log -- which is why it is async. It does NOT request
/// eviction itself. Shared by disk_log_impl::do_gc and cloud-topic
/// ctp_stm housekeeping.| bool disk_log_impl::is_cloud_gc_active() const { | ||
| return is_cloud_retention_active() || config().is_tiered_cloud(); | ||
| } | ||
|
|
There was a problem hiding this comment.
The funny thing is that I had this in my feature branch - https://github.com/redpanda-data/redpanda/pull/30512/changes#diff-8caa0c9719de25bd209fa674959d9327cd55237de2fb4683761acf9bcc6de217R1314
and it was lost in the process (PR stacking / review). Damn.
036d667 to
3f83ea0
Compare
tiered_cloud partition local logs were excluded from the disk space manager, so they were never reclaimed under disk pressure. A new is_cloud_gc_active() predicate (archival retention or tiered_cloud) gates the space manager's reclaim paths, so tiered_cloud partitions are now collected below the reconciled L1 offset, like legacy tiered storage. Also updates disk_log_impl::compute_gc_offset to reset the space management GC hint on every invocation where it is present. Signed-off-by: Oren Leiman <oren.leiman@redpanda.com>
3f83ea0 to
3b6c6e9
Compare
Review: admit tiered_cloud partitions to space managementRead through the whole change. The design is coherent and the moving parts line up well — the eviction-policy filter, the A couple of things I verified and found sound:
Two smaller points left as inline comments:
Note the Reminder per CONTRIBUTING/CLAUDE.md: run Nothing here blocks; overall LGTM. |
disk_log_impl gc() and housekeeping() are no-ops for cloud topics: is_locally_collectable() and is_locally_compacted() are both false, so do_gc returns nullopt and local compaction is skipped. The local log is trimmed by ctp_stm and compaction happens at L1. do_gc asserts it is not reached for tiered_cloud, so returning early for cloud topics also keeps that invariant true: housekeeping_scan calls gc()/housekeeping() for every registered log, cloud topics included. Signed-off-by: Oren Leiman <oren.leiman@redpanda.com>
prefix_truncate_bg waits on _lro_advanced without a timeout once a partition is caught up with no active readers, on the assumption that only a reconciliation advance (which signals _lro_advanced) can create new truncation work. That holds for storage.mode=cloud, but not for tiered_cloud: space management sets _cloud_gc_offset via set_cloud_gc_offset, raising the truncation target without signalling _lro_advanced. An idle tiered_cloud partition with a quiescent LRO would sleep through it and not reclaim until the next write. Exclude tiered_cloud from the untimed wait so it polls on retry_backoff_time and observes the offset; other modes keep the zero-wakeup untimed wait. Signed-off-by: Oren Leiman <oren.leiman@redpanda.com>
- capacity pressure reclaims during produce - space management reclaims an idle partition Signed-off-by: Oren Leiman <oren.leiman@redpanda.com>
3b6c6e9 to
6b3575f
Compare
tiered_cloud (cloud topics / TSv2) partitions were excluded from disk space
management, so their local log was never reclaimed under disk pressure and
could grow until the disk filled. This admits them.
is_cloud_retention_activegatesto include tiered_cloud.
disk_space_managerthen computes a reclaimoffset and sets
_cloud_gc_offsetfor them, as it already does for legacytopics.
ctp_stmreads that offset through the sharedcompute_gc_offsetandtruncates the local log to it.
do_gc(the legacy executor) skipstiered_cloud;
consume_cloud_gc_offsetclears the offset when read.ctp_stm's truncate loop polls on a bounded timeoutrather than waiting untimed, since the offset is set out of band (no
_lro_advancedsignal) and would otherwise be missed on an idle partition.Other modes keep the untimed wait.
(
max_removable_local_log_offset), so un-reconciled data is never dropped.idle-partition reclaim.
Backports Required
Release Notes