Skip to content

Commit 1f403e7

Browse files
jordanhunt22Convex, Inc.
authored andcommitted
Fixed incorrectly bumping retention confirmed deleted ts (#24332)
Made it such that we don't bump the confirmed deleted timestamp of document retention on dry runs GitOrigin-RevId: e5576a096c65195f6437fa7072896616695f4d7f
1 parent b27bfa9 commit 1f403e7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

crates/database/src/retention.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,11 @@ impl<RT: Runtime> LeaderRetentionManager<RT> {
843843
return Ok((new_cursor, total_expired_entries));
844844
}
845845
}
846+
// Don't advance the retention confirmed deleted timestamp if dry run is enabled
847+
if *DOCUMENT_RETENTION_DRY_RUN {
848+
tracing::info!("DRY RUN: Would have deleted {total_expired_entries} documents");
849+
return Ok((cursor, total_expired_entries));
850+
}
846851
tracing::debug!(
847852
"delete: finished loop, returning {:?}",
848853
min_snapshot_ts.pred()
@@ -959,8 +964,8 @@ impl<RT: Runtime> LeaderRetentionManager<RT> {
959964
)
960965
}
961966
for document_to_delete in documents_to_delete.iter() {
962-
// If we're deleting an index entry, we've definitely deleted
963-
// index entries for documents at all prior timestamps.
967+
// If we're deleting a document, we've definitely deleted
968+
// entries for documents at all prior timestamps.
964969
if document_to_delete.0 > Timestamp::MIN {
965970
new_cursor = cmp::max(new_cursor, document_to_delete.0.pred()?);
966971
}

0 commit comments

Comments
 (0)