Conversation
`clean` listed the target databases, dropped them and deleted their rows in a single read-write transaction. Dropping a database is an admin API call that is not rolled back when the transaction is aborted, so an abort left rows for databases that no longer existed. Those rows were listed again on the next run, which tried to drop them again, and once enough rows had accumulated `clean` no longer finished. `clean` now lists the targets in a read-only transaction and then handles each database in its own read-write transaction: it re-reads the row, drops the database and deletes the row. A failure or abort affects only that database, and the rows of databases handled earlier are already committed. The row is skipped if it was removed or updated after it was listed, so a database that was taken out of the pool in the meantime is not dropped. `dropDatabase` created a new admin client on every call. It now takes the admin client from the caller: `Pool` passes the one it already holds, and `CleanAll` creates one for the whole run.
kakudo415
force-pushed
the
clean-per-database-transaction
branch
2 times, most recently
from
September 16, 2026 08:23
f9dfeac to
706b990
Compare
kakudo415
marked this pull request as ready for review
September 16, 2026 08:27
kakudo415
requested review from
sinmetal,
vvakame and
zoncoen
as code owners
September 16, 2026 08:27
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.
Problem
cleanlists the target databases, drops them and deletes their metadata rows in a single read-write transaction. Dropping a database is an admin API call, so it is not rolled back when the transaction is aborted. An abort therefore leaves metadata rows for databases that no longer exist. Those rows are listed again on the next run, which tries to drop them again, and once enough rows have accumulatedcleannever finishes.Changes
cleanlists the targets in a read-only transaction and then handles each database in its own read-write transaction: re-read the row, drop the database, delete the row. A failure or abort affects only that database, and the rows of databases handled earlier are already committed.dropDatabaseno longer creates an admin client on every call. It takes the admin client from the caller:Poolpasses the one it already holds, andCleanAllcreates one for the whole run and closes it afterwards.The first non-
NotFounderror fromDropDatabasestill stops the run, and aNotFoundis still ignored so that the row of an already dropped database is removed.