Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

273 changes: 203 additions & 70 deletions aws_advanced_python_wrapper/aurora_initial_connection_strategy_plugin.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ AuroraInitialConnectionStrategyPlugin.InvalidSettingForEndpoint=[AuroraInitialCo
AuroraInitialConnectionStrategyPlugin.InvalidSettingForInstanceEndpoint=[AuroraInitialConnectionStrategyPlugin] Parameter '{}' cannot be set when using an instance endpoint. Please see the Aurora Initial Connection Strategy Plugin documentation for valid setting/endpoint combinations.
AuroraInitialConnectionStrategyPlugin.InvalidPropertyValue=[AuroraInitialConnectionStrategyPlugin] Received an invalid value for parameter '{}'. Received '{}', valid values are {}.
AuroraInitialConnectionStrategyPlugin.Timeout=[AuroraInitialConnectionStrategyPlugin] The Aurora Initial Connection Strategy Plugin attempted to connect but timed out after {}ms. Please ensure that your URL is correct, there are no network issues, and you are connecting to the correct role if '{}' was set.
AuroraInitialConnectionStrategyPlugin.IncorrectRole=[AuroraInitialConnectionStrategyPlugin] The connection opened to '{}' did not have the expected role '{}'. Retrying.
AuroraInitialConnectionStrategyPlugin.TimeoutWithCause=[AuroraInitialConnectionStrategyPlugin] The Aurora Initial Connection Strategy Plugin attempted to connect but timed out after {}ms. Please ensure that your URL is correct, there are no network issues, and you are connecting to the correct role if '{}' was set. The last failure was: {}
AuroraInitialConnectionStrategyPlugin.InvalidSettingForManagedEndpoint=[AuroraInitialConnectionStrategyPlugin] Parameter '{}' cannot be set to '{}' when using a proxy or Limitless shard group endpoint, because substituting an instance host would bypass that endpoint.
AuroraInitialConnectionStrategyPlugin.WaitForTopologyError=[AuroraInitialConnectionStrategyPlugin] An error occurred while waiting for the cluster topology to be fetched: {}. Falling back to connecting via the provided endpoint.
AuroraInitialConnectionStrategyPlugin.IncorrectRole=[AuroraInitialConnectionStrategyPlugin] The connection opened to '{}' should have the role '{}' but has the role '{}'.
AuroraInitialConnectionStrategyPlugin.VerifyReaderConfiguredButNoReadersExist=[AuroraInitialConnectionStrategyPlugin] Parameter '{}' was set to 'reader' but no readers were detected in the topology. The writer will be used as a fallback.
AuroraInitialConnectionStrategyPlugin.WaitingForTopology=[AuroraInitialConnectionStrategyPlugin] Waiting up to {}ms for the cluster topology of '{}' to be fetched before opening a new connection.
AuroraInitialConnectionStrategyPlugin.WaitForTopologyTimeout=[AuroraInitialConnectionStrategyPlugin] Timed out after {}ms while waiting for the cluster topology of '{}' to be fetched. Falling back to connecting via the provided endpoint.
Expand Down
25 changes: 15 additions & 10 deletions docs/PYTHON-WRAPPER-CONFIGURATION-ASSISTANT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2420,8 +2420,9 @@ and replaces it with the current writer.
- **In the default list:** yes.
- **Use with:** Aurora writer and reader cluster endpoints, custom
cluster endpoints, and the Global Database writer endpoint.
- With an instance endpoint the only valid setting is `none`, so the
plugin does not substitute or verify.
- With an instance endpoint the only valid `endpoint_substitution_role`
is `none`, so the plugin does not substitute. It verifies the role only
when `verify_opened_connection_type` is set.
**Parameters:**
Expand All @@ -2431,9 +2432,9 @@ and replaces it with the current writer.
| `reader_initial_connection_host_selector_strategy` | `random` | Deprecated. Read only when `initial_connection_host_selector_strategy` is not set at all. |
| `endpoint_substitution_role` | (derived) | `writer`, `reader` or `none`. When unset: `writer` for writer cluster and global writer endpoints, `reader` for reader cluster endpoints, `none` for everything else. |
| `verify_opened_connection_type` | (derived) | `writer`, `reader` or `none`. When unset it follows the same rule as `endpoint_substitution_role`. Invalid values raise `InvalidPropertyValue`. |
| `inactive_cluster_writer_endpoint_substitution_role` | `writer` | Global Database: whether to replace the writer endpoint of a cluster that is not currently primary. `writer` or `none`. |
| `verify_inactive_cluster_writer_endpoint_connection_type` | `writer` | Global Database: whether to verify a connection opened through that endpoint is a writer. `writer` or `none`. |
| `open_connection_retry_timeout_ms` | `30000` | Maximum time in milliseconds for connection retries. |
| `inactive_cluster_writer_endpoint_substitution_role` | `writer` | Global Database: whether to replace the writer endpoint of a cluster that is not currently primary. `writer` or `none`. Also decides any writer cluster endpoint while the topology is not known yet, such as the first connection a process opens. |
| `verify_inactive_cluster_writer_endpoint_connection_type` | `writer`, or `none` when unset and `inactive_cluster_writer_endpoint_substitution_role` is `none` | Global Database: whether to verify a connection opened through that endpoint is a writer. `writer` or `none`. |
| `open_connection_retry_timeout_ms` | `30000` | Maximum time in milliseconds for connection retries. `0` makes one attempt with no retries. |
| `open_connection_retry_interval_ms` | `1000` | Wait in milliseconds between retries. |
| `wait_for_initial_topology_ms` | `0` | When above 0, wait up to this long for the topology before the first connection, so the strategy can spread concurrent and pool-prefill connections across instances instead of sending all of them to the one host DNS returns. `0` turns the wait off. |
| `gdb_accessible_regions` | (all regions) | Skip hosts outside these regions. Sync only in 3.1.0. |
Expand All @@ -2448,16 +2449,20 @@ an error:
| Reader cluster | `reader`, `none` | `reader`, `none` |
| Custom cluster | `reader`, `none` | `reader`, `none` |
| Instance | `none` only | `writer`, `reader` or `none` (not restricted) |
| RDS Proxy or Limitless shard group | `none` only | `writer`, `reader` or `none` (not restricted) |
`endpoint_substitution_role=any` is accepted for a custom cluster
endpoint but raises an unsupported-strategy error at connect in 3.1.0.
Use `reader` or `none`.
**Behavior to tell the user about:** a network error while connecting
is retried until `open_connection_retry_timeout_ms` runs out, and then
the plugin raises `AwsWrapperError`. So when the database is down, a
connect call can take up to 30 seconds with the defaults before it
fails. A login error is not retried. When a reader is requested but the
**Behavior to tell the user about:** for writer, reader and global
writer cluster endpoints, a network error while connecting is retried
until `open_connection_retry_timeout_ms` runs out, and then the plugin
raises `AwsWrapperError` naming the last failure. So when the database
is down, a connect call can take up to 30 seconds with the defaults
before it fails. When the plugin has nothing to substitute and no role
to verify (instance endpoints, RDS Proxy, custom cluster endpoints by
default), it connects once and raises the driver's error. A login error is not retried. When a reader is requested but the
cluster is without readers, the plugin returns the writer connection, as
the reader cluster endpoint would.
Expand Down
Loading