feat: enhance online migration with auto-creation and cleanup of publications and slots#6
feat: enhance online migration with auto-creation and cleanup of publications and slots#6isdaniel wants to merge 4 commits into
Conversation
isdaniel
commented
May 8, 2026
- Added support for auto-creating publications during online migration if they do not exist.
- Implemented cleanup of auto-created publications and replication slots after successful cutover.
- Introduced CLI flags to control the auto-creation of publications and retention of replication slots.
- Updated documentation to reflect changes in migration phases and resource management.
- Added integration tests to verify the lifecycle of publications and slots during online migrations.
…ications and slots - Added support for auto-creating publications during online migration if they do not exist. - Implemented cleanup of auto-created publications and replication slots after successful cutover. - Introduced CLI flags to control the auto-creation of publications and retention of replication slots. - Updated documentation to reflect changes in migration phases and resource management. - Added integration tests to verify the lifecycle of publications and slots during online migrations.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6 +/- ##
==========================================
- Coverage 90.22% 89.49% -0.74%
==========================================
Files 16 16
Lines 5154 5633 +479
==========================================
+ Hits 4650 5041 +391
- Misses 504 592 +88 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Code Review
This pull request implements automatic lifecycle management for PostgreSQL replication resources, enabling the migrator to auto-create publications and clean up publications and slots after cutover. It also introduces table-level progress reporting for dump and restore tasks and updates documentation to include a new SourceCleanup stage. Technical feedback highlights a bug in quoting schema-qualified table names, a state persistence issue for auto-created publications during migration resumes, a potential race condition when dropping replication slots, and a naming inconsistency between the code and documentation regarding the cleanup stage.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces automated lifecycle management for PostgreSQL replication resources during online migrations. It adds a new SourceCleanup pipeline stage to drop auto-created publications and replication slots after a successful cutover, controlled by new CLI flags --no-auto-create-publication and --keep-slot. The PR also improves progress visibility by parsing pg_dump and pg_restore stderr for table-level updates. Review feedback highlights opportunities to improve the robustness of SQL identifier quoting, refine the logic for mixed table/schema publications, and ensure consistent error propagation in cleanup functions to align with the project's design principles.
- Fix schema-qualified quoting: validate empty parts, reject trailing/leading dots - Combine tables+schemas in CREATE PUBLICATION (PG 15+ syntax) - Propagate errors from drop_source_publication/drop_source_slot instead of swallowing - Fix emit_table_progress to capture full identifier (not strip outer quotes) - Persist pub_auto_created in ResumeToken for crash-safe cleanup - Add SourceCleanup stage to MigrationStage enum - Extract cleanup_source_after_cutover as public testable function - Add wait_for_slot_inactive before drop_source_slot post-cutover - Add integration tests for cleanup_source_after_cutover - Fix CI port conflict: clean up stale containers before starting stack Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces automated lifecycle management for replication resources during online migrations, including the auto-creation of PostgreSQL publications and the post-cutover cleanup of publications and replication slots. It also enhances progress reporting by parsing table-level updates from pg_dump and pg_restore stderr. Feedback highlights a critical issue where auto-created publications do not respect exclude_tables or exclude_schemas, potentially causing the target apply worker to crash if excluded objects are modified on the source.
|
/gemini review |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces automated lifecycle management for PostgreSQL replication resources, enabling the migrator to auto-create publications on the source and clean up publications and replication slots after cutover. New CLI flags, --no-auto-create-publication and --keep-slot, provide control over these features. The PR also adds table-level progress reporting during dump and restore operations and updates the project's documentation and integration tests. Reviewers identified a potential bug in identifier quoting for schema names containing dots and a resource leak edge case in the resume logic. Additionally, there is a suggestion to move table-level progress logs to a lower severity level to avoid excessive output in large databases.
There was a problem hiding this comment.
Code Review
This pull request introduces automated lifecycle management for PostgreSQL replication resources, specifically publications and replication slots. The migrator now supports auto-creating publications on the source—respecting table and schema exclusions—and includes a new SourceCleanup stage to drop auto-created resources after cutover. New CLI flags, --no-auto-create-publication and --keep-slot, allow users to override these defaults. The PR also enhances progress visibility by emitting table-level updates from pg_dump and pg_restore, refactors the Agent.md developer guide, and adds extensive integration tests for the new functionality. I have no feedback to provide.