You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guides/hosting-guardrails/disaster-recovery/database-upgrade/index.md
+58-3Lines changed: 58 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -260,7 +260,7 @@ In a new session, initiate the `pg_dump` process using the `snapshot ID` obtaine
260
260
nohup time pg_dump -h $SOURCE -U master --snapshot="00000062-000182C4-1" -F c -b -v -f data.dump turbot > dump.log 2>&1&
261
261
```
262
262
263
-
> [!CAUTION]
263
+
> [!CAUTION]
264
264
> Enabling logical replication before a long pg_dump/restore can lead to WAL buildup and storage exhaustion. It is recommended to enable RDS storage autoscaling to prevent out-of-space errors during migration.
265
265
### Monitor
266
266
@@ -523,7 +523,7 @@ Run smoke tests to Test both the restored and new database instances to confirm
523
523
<!-- TO CHECK IF THIS WILL TERMINATE THE OLD RDS INSTANCE turbot-einstein-blue? -->
524
524
<!-- INCLUDE TERMINATION PROTECTION NOTE HERE FOR RDS INSTANCE -->
525
525
526
-
Delete the new TED stack i.e.`turbot-einstein-green`along with its associated resources, including the S3 bucket, log groups, and AWS Backup. Clean up replication slots and subscriptions.
526
+
After verifying a successful upgrade and switchover, delete the new TED stack i.e `turbot-einstein-green`and remove its associated resources such as the S3 bucket, CloudWatch log groups, and AWS Backup configurations. Clean up replication slots and subscriptions.
527
527
528
528
<!-- When the old DB is terminated from the TED stack, the following will be automatically cleaned up.
529
529
@@ -533,11 +533,66 @@ select * from pg_replication_slots;
533
533
select * from pg_drop_replication_slot('rs_blue');
534
534
drop schema migration_turbot cascade; -->
535
535
536
+
### In Case of Upgrade Failure or Aborted Migration
537
+
538
+
If the database upgrade fails or is manually aborted before completion, it’s important to clean up replication artifacts from the **source database** to avoid lingering replication objects and ensure a clean state for future upgrade attempts.
539
+
540
+
Run the following SQL commands on the source (blue) database to drop replication artifacts:
541
+
542
+
```sql
543
+
-- Check for existing publications
544
+
SELECT*FROM pg_publication;
545
+
546
+
-- Drop the publication used for replication
547
+
DROP PUBLICATION pub_blue;
548
+
549
+
-- Check for replication slots
550
+
SELECT*FROM pg_replication_slots;
551
+
552
+
-- Drop the replication slot used for streaming
553
+
SELECT*FROM pg_drop_replication_slot('rs_blue');
554
+
555
+
-- Check for existing subscriptions
556
+
SELECT*FROM pg_subscription;
557
+
558
+
-- Drop the subscription created during upgrade
559
+
DROP SUBSCRIPTION sub_blue;
560
+
```
561
+
562
+
**Example:**
563
+
564
+
Here's an example showing how to check for and clean up a leftover publication:
565
+
566
+
`select * from pg_publication` indicates the presence of left over `PUBLICATION``pub_blue`, this needs to be dropped. Recheck after dropping the `PUBLICATION`
0 commit comments