Skip to content

Commit 3f3e811

Browse files
committed
cloud_topics/stm: bound the prefix-truncate wait for tiered_cloud
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>
1 parent 3810690 commit 3f3e811

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/v/cloud_topics/level_zero/stm/ctp_stm.cc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,9 @@ ss::future<> ctp_stm::prefix_truncate_bg() {
116116
// trims aggressively (the local log only holds placeholders);
117117
// storage.mode=tiered_cloud honors local retention plus the compaction
118118
// floor and so keeps more data locally.
119+
const bool is_tiered = _raft->log()->config().is_tiered_cloud();
119120
model::offset target;
120-
if (_raft->log()->config().is_tiered_cloud()) {
121+
if (is_tiered) {
121122
target = co_await compute_local_retention_offset();
122123
} else {
123124
// storage.mode=cloud keeps only placeholders locally; the
@@ -133,10 +134,12 @@ ss::future<> ctp_stm::prefix_truncate_bg() {
133134
_raft->last_snapshot_index());
134135
try {
135136
if (
136-
_raft->last_snapshot_index() >= target
137-
&& _active_readers.empty()) {
137+
_raft->last_snapshot_index() >= target && _active_readers.empty()
138+
&& !is_tiered) {
138139
// Only wait without a timeout if there are no active readers
139-
// that could be holding us back.
140+
// that could be holding us back. tiered_cloud always polls
141+
// because its space-management offset is set without signalling
142+
// _lro_advanced.
140143
co_await _lro_advanced.wait();
141144
} else {
142145
co_await _lro_advanced.wait(retry_backoff_time);

0 commit comments

Comments
 (0)