Repository navigation
fix(deletion): close the review findings on the batched purge - #10095
Open
TheSentinel454 wants to merge 7 commits into
Open
TheSentinel454 wants to merge 7 commits into
TheSentinel454 wants to merge 7 commits into
Conversation
Two merges each added tracing-subscriber to buzz-db's dev-dependencies. Cargo refuses a manifest with a duplicate key, so main does not build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Luke Tornquist <tornquist@squareup.com>
…e retries The search indexer's reset deletes every search_backfill row without community admission, so purge batches lock the search_backfill rows they pick. A batch that changed rows now records its lease generation in the checkpoint detail. record_retry starts the streak at zero for an attempt that made progress, so the block comes after eight attempts with none. This replaces the per-batch retry_count reset, which a later failure in the same attempt undid. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Luke Tornquist <tornquist@squareup.com>
The purge logs each committed batch at info under buzz_db::store::deletion, but the default filter kept buzz_db at warn, so a drain without RUST_LOG printed no batch timings. Keep that target at info and say so in the operator runbook. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Luke Tornquist <tornquist@squareup.com>
A purge batch fails when a migration adds an unlisted tenant table after the attempt's first catalog check. That failure was a DeletionSafety error, which the executor treats as permanent, so the request blocked until an operator ran deletions unblock. Return a retryable error instead; the next attempt's first check skips and logs the table. A missing listed table still fails closed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Luke Tornquist <tornquist@squareup.com>
#10074 added the skipped-tables argument to purge_in_batches after this test was written. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Luke Tornquist <tornquist@squareup.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Luke Tornquist <tornquist@squareup.com>
TheSentinel454
requested review from
a team,
bradseiler,
ravarora2,
salman1993 and
wpfleger96
as code owners
December 1, 2026 23:18
🔐 Codex Security Review
Review SummaryOverall Risk: NONE
FindingsNo concrete security, correctness, or reliability findings were identified. Notes
Generated by Codex Security Review | |
A purge batch that changed rows clears the retry streak again, in its own transaction, so the reset holds when the attempt ends without record_retry. record_retry treats a failure as progress only when the progress checkpoint is in the failing stage, so a later stage under the same lease still counts its first failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Luke Tornquist <tornquist@squareup.com>
bradseiler
approved these changes
Dec 1, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Community deletion purges PostgreSQL in bounded batches since #10081. Reviews of #10081 and #10074 found four gaps that merged with the stack:
DELETE FROM search_backfillfor all communities, without community admission. A purge batch that picked those rows without a lock could count rows the reset had already deleted.retry_countto zero. A later failure in the same attempt then counted 1, so an attempt that made progress still counted toward the block.buzz_db::store::deletion.buzz-admin's default filter keptbuzz_dbat warn, so a drain withoutRUST_LOGprinted no timings.community_idtable after the attempt's first catalog check, the batch failed with aDeletionSafetyerror. The executor treats that error as permanent, so the request blocked until an operator randeletions unblock.What
search_backfilllock the rows they pick (FOR UPDATE), and wait for a concurrent reset.buzz-adminlogsbuzz_db::store::deletionat info by default. The operator runbook says so.How
detail.progress_generationon the existing checkpoint row.record_retrychecks it with oneEXISTSquery that also matches the failing stage, so a later stage under the same lease still counts its first failure.record_retry(a lost lease or a shutdown).is_permanent_errordoes not change. The mid-purge drift error is nowDbError::InvalidData, which it already treats as retryable.Risk
Low to medium. The change touches the live deletion path in
buzz-db. Community deletion is suspended in production until the operator re-enables it, so no request runs this code before then.Testing
On a Linux workstation with PostgreSQL 16, at the PR head:
cargo fmt,clippy -D warnings, andnextest --lib --testsforbuzz-db,buzz-deletion,buzz-admin.store::deletion::andbuzz-deletion.search_backfilllock, ignore the progress marker, a permanent error for mid-purge drift, no batch streak reset, and progress matched in any stage.buzz-admin deletions drainwithRUST_LOGunset: stdout held one JSON result, and stderr held JSON batch records withtable,rows, andelapsed_ms.Bigger picture
This closes the review findings on #10081 and #10074. The remaining step before deletion is re-enabled is a supervised staging run.
🤖 Generated with Claude Code