Skip to content

Commit 77de3b0

Browse files
goffrieConvex, Inc.
authored andcommitted
Start retention deletion workers right away, instead of waiting for min snapshot ts to advance (#43115)
As written, the deletion worker won't wake up until the min-snapshot cursor is advanced the first time, even if there is lag between the confirmed-deleted cursor and the min-snapshot cursor. And if we increase the retention delay, the min-snapshot ts will already be far ahead of the desired ts, so we won't advance it for a long time. So the deletion worker won't wake up. Instead we should always wake up the worker on the first iteration so that we can start working on any lag there may be. GitOrigin-RevId: bd99ae0ead48e6d438120b1d97bc45d4b6b57673
1 parent 65ce958 commit 77de3b0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

crates/database/src/retention.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,6 +1079,7 @@ impl<RT: Runtime> LeaderRetentionManager<RT> {
10791079
let mut error_backoff = Backoff::new(INITIAL_BACKOFF, *MAX_RETENTION_DELAY_SECONDS);
10801080
let mut min_snapshot_ts = RepeatableTimestamp::MIN;
10811081
let mut is_working = false;
1082+
min_snapshot_rx.mark_changed();
10821083
loop {
10831084
if !is_working {
10841085
min_snapshot_ts = match min_snapshot_rx.changed().await {
@@ -1204,6 +1205,7 @@ impl<RT: Runtime> LeaderRetentionManager<RT> {
12041205
let mut is_working = false;
12051206
let mut interval = tokio::time::interval(*DOCUMENT_RETENTION_BATCH_INTERVAL_SECONDS);
12061207
interval.set_missed_tick_behavior(MissedTickBehavior::Delay);
1208+
min_document_snapshot_rx.mark_changed();
12071209

12081210
loop {
12091211
if !is_working {

0 commit comments

Comments
 (0)