Repository navigation
fix: failover and read/write splitting use the plugin service's host list provider in aio #1371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,6 +41,7 @@ | |
|
|
||
| from aws_advanced_python_wrapper.utils.log import Logger | ||
| from .utils.rds_test_utility import RdsTestUtility | ||
| from .utils.retry_helper import retry_until | ||
| from .utils.test_environment import TestEnvironment | ||
| from .utils.test_environment_features import TestEnvironmentFeatures | ||
| from .utils.test_timings import FAILOVER_WITHIN_TRANSACTION_PYTEST_TIMEOUT_SEC | ||
|
|
@@ -269,6 +270,8 @@ async def inner() -> None: | |
| # than the control-plane ``DescribeDBClusters.IsClusterWriter``, | ||
| # which can lag by tens of seconds to minutes post-failover. | ||
| assert await query_host_role_async(conn) == HostRole.WRITER | ||
| # RDS API lags behind the writer election, so we retry the check. | ||
| assert retry_until(lambda: aurora_utility.is_db_instance_writer(current_connection_id)) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we still need this retry_util? I believe the RDS team pushed a fix that should have addressed the RDS API lag issue that we have been seeing?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just added to keep it the same as the sync tests but can remove it from both if it is not required. |
||
| next_cluster_writer_id = aurora_utility.get_cluster_writer_instance_id() | ||
| assert current_connection_id == next_cluster_writer_id | ||
| assert current_connection_id != initial_writer_id | ||
|
|
@@ -318,6 +321,8 @@ async def inner() -> None: | |
| # than the control-plane ``DescribeDBClusters.IsClusterWriter``, | ||
| # which can lag by tens of seconds to minutes post-failover. | ||
| assert await query_host_role_async(conn) == HostRole.WRITER | ||
| # RDS API lags behind the writer election, so we retry the check. | ||
| assert retry_until(lambda: aurora_utility.is_db_instance_writer(current_connection_id)) | ||
| next_cluster_writer_id = aurora_utility.get_cluster_writer_instance_id() | ||
| assert current_connection_id == next_cluster_writer_id | ||
| assert current_connection_id != initial_writer_id | ||
|
|
@@ -367,6 +372,8 @@ async def inner() -> None: | |
| # assert that we are connected to the new writer after failover happens | ||
| # Data-plane writer check; see earlier sites for rationale. | ||
| assert await query_host_role_async(conn) == HostRole.WRITER | ||
| # RDS API lags behind the writer election, so we retry the check. | ||
| assert retry_until(lambda: aurora_utility.is_db_instance_writer(current_connection_id)) | ||
| next_cluster_writer_id: str = aurora_utility.get_cluster_writer_instance_id() | ||
|
|
||
| assert current_connection_id == next_cluster_writer_id | ||
|
|
@@ -424,6 +431,8 @@ async def inner() -> None: | |
| # assert that we are connected to the new writer after failover happens | ||
| # Data-plane writer check; see earlier sites for rationale. | ||
| assert await query_host_role_async(conn) == HostRole.WRITER | ||
| # RDS API lags behind the writer election, so we retry the check. | ||
| assert retry_until(lambda: aurora_utility.is_db_instance_writer(current_connection_id)) | ||
| next_cluster_writer_id: str = aurora_utility.get_cluster_writer_instance_id() | ||
|
|
||
| assert current_connection_id == next_cluster_writer_id | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, its also there in the sync version of failover. Without it, the async version misses the connection closed in the cursor() which fails to failover