I want to resolve errors that occur when I create blue/green deployments in Amazon Relational Database Service (Amazon RDS) for PostgreSQL and Amazon Aurora PostgreSQL-Compatible Edition.
Resolution
Review the limitations for blue/green deployments and identify your error
Review the limitations for blue/green deployments for Amazon RDS and Aurora PostgreSQL-Compatible.
To find the specific error message for your deployment, complete the following steps:
- Open the Amazon RDS console.
- In the navigation pane, choose Databases.
- Select your blue/green deployment.
- Choose the Logs & events tab.
- Review the logs for error messages.
Resolve the logical replication configuration error
If you create a blue/green deployment but don't activate logical replication, then you receive the following error message:
"Blue/Green Deployments require a DB instance with logical replication enabled. Before you create a Blue/Green Deployment for a DB instance, associate the DB instance with a custom DB instance parameter group that enables logical replication."
To activate logical replication, complete the following steps:
- Create a custom parameter group or modify an existing group.
- Set the rds.logical_replication parameter to 1.
- Apply the custom parameter group to your DB instance.
Note: You can't modify default parameter group values.
Resolve incompatible replication parameters
If you create a blue/green deployment with insufficient replication slots for your database count, then you receive the following error message:
"Creation of blue/green deployment failed due to incompatible parameter(s): max_replication_slots, and max_logical_replication_workers."
To resolve this issue, complete the following steps:
-
Run the following query to view a list of your databases:
SELECT datname FROM pg_database;
-
Modify the following parameters in your custom parameter group:
Set max_replication_slots to a value that's higher than your total database count.
Set max_wal_senders and max_logical_replication_workers to a value that's equal to your active logical replication slots.
Set max_worker_processes to a value that's equal to the sum of max_logical_replication_workers, autovacuum_max_workers, and max_parallel_workers.
-
Create a new blue/green deployment.
Resolve the external replication slots error
If you create a blue/green deployment when external replication slots exist, then you receive the following error message:
"Replica creation is canceled due to external replication."
To resolve this issue, complete the following steps:
-
Run the following command to check for existing replication slots:
SELECT * FROM pg_replication_slots WHERE slot_type NOT LIKE 'physical';
-
Run the following command to drop the identified slot:
SELECT pg_drop_replication_slot(slot_name);
Note: Replace slot_name with the name of the replication slot.
Resolve DDL changes that occur after deployment
If you change the Data Definition Language (DDL) or modify large objects after you create a blue/green deployment, then you receive the following error message:
"DDL changes aren't supported for blue/green deployments. These changes aren't replicated from the blue environment to the green environment, and switchover will be blocked. Your green databases now have a status of REPLICATION_DEGRADED. Delete and recreate your blue/green deployment and avoid future DDL changes."
To resolve this issue, delete your blue/green deployment. Then, create a new blue/green deployment.
After deployment, don't change the DDL and large objects in the blue environment.
Resolve table primary key errors
If you update or delete records in tables that don't have primary keys, then you receive the following error message:
"Logical replication target relation 'public.image_audit' has neither REPLICA IDENTITY index nor PRIMARY KEY and published relation does not have REPLICA IDENTITY FULL"
To resolve this issue, add primary keys to tables that require updates or deletes. Then, run the following command to set REPLICA IDENTITY FULL:
ALTER TABLE table_name REPLICA IDENTITY FULL;
Note: Replace table_name with your table name.
Resolve PG_CRON extension conflicts
If you use the pg_cron extension in your deployment, then you might receive the following error message:
"role 'rdsrepladmin' cannot SET ROLE to 'rds_superuser'"
Replication conflicts can occur because the pg_cron extension's background workers run as a superuser and bypass read-only settings.
To resolve this issue, turn off the pg_cron extension on all green databases after you create the blue/green deployment. Keep the extension turned off throughout the deployment.