Skip to content

Fix early snapshot release and defer indexes with --follow#53

Open
teknogeek0 wants to merge 1 commit intomainfrom
feature/early-snapshot-release
Open

Fix early snapshot release and defer indexes with --follow#53
teknogeek0 wants to merge 1 commit intomainfrom
feature/early-snapshot-release

Conversation

@teknogeek0
Copy link
Copy Markdown
Owner

Summary

  • Fix blob snapshot connection leak: copydb_has_large_objects() opens a REPEATABLE READ snapshot connection to check pg_largeobject_metadata but never closes it, pinning backend_xmin on the source through index building and post-data restore. The fix closes the connection immediately after the query.
  • Defer index creation to parent process with --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.
  • Wire new test suites into CI: Add blob-snapshot-release and follow-defer-indexes test suites to the Makefile and GitHub Actions matrix.

Cherry-picked from planetscale#22.

Test plan

  • blob-snapshot-release test suite passes
  • follow-defer-indexes test suite passes
  • All existing test suites pass

- 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant