Skip to content

Commit 268d816

Browse files
committed
merge with main
2 parents ab49fbc + d8526be commit 268d816

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+6943
-1401
lines changed

README.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,35 @@ To find all the documentation and concrete examples on how to use the AWS Advanc
152152

153153
#### Amazon RDS Blue/Green Deployments
154154

155-
This driver currently does not support switchover in Amazon RDS Blue/Green Deployments. In order to execute a Blue/Green deployment with the driver,
156-
please ensure your application is coded to retry the database connection. Retry will allow the driver to re-establish a connection to an available
157-
database instance. Without a retry, the driver will not be able to identify an available database instance after blue/green switchover has occurred.
155+
Although the AWS Advanced Python Wrapper is not compatible with [AWS Blue/Green Deployments](https://docs.aws.amazon.com/whitepapers/latest/overview-deployment-options/bluegreen-deployments.html) and does not officially support them, the combination of the AWS Advanced Python Wrapper and the Failover Plugin has been validated for use with clusters that employ Blue/Green Deployments. While general basic connectivity to both Blue and Green clusters is always in place, some failover cases are not fully supported.
156+
The current limitations are:
157+
- After a Blue/Green switchover, the wrapper may not be able to properly detect the new topology and handle failover, as there are discrepancies between the metadata and the available endpoints.
158+
- The specific database version requirements for different database deployments may vary, as the internal systems used by the wrapper can differ.
159+
160+
The development team is aware of these limitations and is working to improve the wrapper's awareness and handling of Blue/Green switchovers.
161+
162+
> [!WARNING]\
163+
> The AWS Advanced Python Wrapper now includes support for Blue/Green Deployments according to the description below:
164+
>
165+
> Currently Supported Database Deployments:
166+
> - Aurora MySQL and PostgreSQL clusters
167+
> - RDS MySQL and PostgreSQL instances
168+
>
169+
> Unsupported Database Deployments and Configurations:
170+
> - RDS MySQL and PostgreSQL Multi-AZ clusters
171+
> - Aurora Global Database for MySQL and PostgreSQL
172+
>
173+
> Supported RDS PostgreSQL Versions: `rds_tools v1.7 (17.1, 16.5, 15.9, 14.14, 13.17, 12.21)`.<br>
174+
> Supported Aurora PostgreSQL Versions: Engine Release `17.5, 16.9, 15.13, 14.18, 13.21`.<br>
175+
> Supported Aurora MySQL Versions: Engine Release `3.07` and above.
176+
>
177+
> For RDS Postgres, you will also need to manually install the `rds_tools` extension using the following DDL so that the metadata required by the driver is available:
178+
>
179+
> ```sql
180+
> CREATE EXTENSION rds_tools;
181+
> ```
182+
>
183+
> If your database version does **not** match the supported versions listed above, the driver will automatically fallback to its previous behaviour. In this fallback mode, Blue/Green handling is subject to the same limitations listed above. If you have questions or encounter issues, please open an issue in this repository.
158184
159185
#### MySQL Connector/Python C Extension
160186

aws_advanced_python_wrapper/aurora_initial_connection_strategy_plugin.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def _get_verified_writer_connection(self, props: Properties, is_initial_connecti
8686
self._plugin_service.force_refresh_host_list(writer_candidate_conn)
8787
writer_candidate = self._plugin_service.identify_connection(writer_candidate_conn)
8888

89-
if writer_candidate is not None and writer_candidate.role != HostRole.WRITER:
89+
if writer_candidate is None or writer_candidate.role != HostRole.WRITER:
9090
self._close_connection(writer_candidate_conn)
9191
self._delay(retry_delay_ms)
9292
continue
@@ -133,6 +133,11 @@ def _get_verified_reader_connection(self, props: Properties, is_initial_connecti
133133
self._plugin_service.force_refresh_host_list(reader_candidate_conn)
134134
reader_candidate = self._plugin_service.identify_connection(reader_candidate_conn)
135135

136+
if reader_candidate is None:
137+
self._close_connection(reader_candidate_conn)
138+
self._delay(retry_delay_ms)
139+
continue
140+
136141
if reader_candidate is not None and reader_candidate.role != HostRole.READER:
137142
if self._has_no_readers():
138143
# Cluster has no readers. Simulate Aurora reader cluster endpoint logic and return the current writer connection.

0 commit comments

Comments
 (0)