Skip to content

Commit

Permalink
Fixed incorrectly bumping retention confirmed deleted ts (#24332)
Browse files Browse the repository at this point in the history
Made it such that we don't bump the confirmed deleted timestamp of document retention on dry runs

GitOrigin-RevId: e5576a096c65195f6437fa7072896616695f4d7f
  • Loading branch information
jordanhunt22 authored and Convex, Inc. committed Apr 4, 2024
1 parent b27bfa9 commit 1f403e7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions crates/database/src/retention.rs
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,11 @@ impl<RT: Runtime> LeaderRetentionManager<RT> {
return Ok((new_cursor, total_expired_entries));
}
}
// Don't advance the retention confirmed deleted timestamp if dry run is enabled
if *DOCUMENT_RETENTION_DRY_RUN {
tracing::info!("DRY RUN: Would have deleted {total_expired_entries} documents");
return Ok((cursor, total_expired_entries));
}
tracing::debug!(
"delete: finished loop, returning {:?}",
min_snapshot_ts.pred()
Expand Down Expand Up @@ -959,8 +964,8 @@ impl<RT: Runtime> LeaderRetentionManager<RT> {
)
}
for document_to_delete in documents_to_delete.iter() {
// If we're deleting an index entry, we've definitely deleted
// index entries for documents at all prior timestamps.
// If we're deleting a document, we've definitely deleted
// entries for documents at all prior timestamps.
if document_to_delete.0 > Timestamp::MIN {
new_cursor = cmp::max(new_cursor, document_to_delete.0.pred()?);
}
Expand Down

0 comments on commit 1f403e7

Please sign in to comment.