Fix early snapshot release and defer indexes with --follow#53
Open
teknogeek0 wants to merge 1 commit intomainfrom
Open
Fix early snapshot release and defer indexes with --follow#53teknogeek0 wants to merge 1 commit intomainfrom
teknogeek0 wants to merge 1 commit intomainfrom
Conversation
- Close blob snapshot connection after large object check to unpin backend_xmin on source - Defer index creation to parent process when --defer-indexes --follow are combined, releasing source connections earlier - Add blob-snapshot-release and follow-defer-indexes test suites
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.
Summary
copydb_has_large_objects()opens a REPEATABLE READ snapshot connection to checkpg_largeobject_metadatabut never closes it, pinningbackend_xminon the source through index building and post-data restore. The fix closes the connection immediately after the query.--defer-indexes --follow: When both flags are used, STEP 6 (CREATE INDEX), STEP 7 (constraints), and STEP 8 (VACUUM) are skipped in the clone subprocess. The clone child exits after COPY + blobs, releasing all source connections early. The parent process then builds indexes using parallel workers after the snapshot is released.blob-snapshot-releaseandfollow-defer-indexestest suites to the Makefile and GitHub Actions matrix.Cherry-picked from planetscale#22.
Test plan
blob-snapshot-releasetest suite passesfollow-defer-indexestest suite passes