Skip to content

chore: gdb regions - #1266

Open
karenc-bq wants to merge 1 commit into
chore/initial-strategy-plugin-asyncfrom
chore/gdb-aws-region
Open

chore: gdb regions#1266
karenc-bq wants to merge 1 commit into
chore/initial-strategy-plugin-asyncfrom
chore/gdb-aws-region

Conversation

@karenc-bq

@karenc-bq karenc-bq commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add support for restricting Aurora Global Database operations to a subset of accessible AWS regions (gdb_accessible_regions)
  • Add configurable monitoring connection priority for the topology monitor (monitoring_connection_priority, gdb_monitoring_connection_priority)
  • Wire panic-mode exit via reader-consensus / harvested connections when the writer is in an inaccessible region

Description

  • GdbFailoverPlugin — failover candidates are filtered by accessible regions. In strict-writer mode, failover fails fast if the writer is in a non-accessible region.

  • GdbReadWriteSplittingPlugin — writer connections to non-accessible regions are rejected. Reader candidates are filtered before applying home-region restrictions.

  • GlobalAuroraTopologyMonitor — topology monitoring host workers skip non-accessible regions. The initial host's region is validated and the monitor fails fast if it is not accessible. When the writer is unreachable, the monitor exits panic mode by adopting harvested reader connections (stable-reader-topology consensus).

  • AuroraInitialConnectionStrategyPlugin — host candidates are filtered by accessible regions before strategy-based selection. Filtering is delegated to the dialect via DatabaseDialect.filter_available_hosts(hosts, accessible_regions), which is a no-op for non-Global dialects and an actual region filter for GlobalAuroraMysqlDialect and GlobalAuroraPgDialect.

    Both GdbFailoverPlugin and GdbReadWriteSplittingPlugin validate at initialization that the configured home region is included in the accessible regions list when both are specified.

    New configuration parameter monitoring_connection_priority

    Comma-separated ordered list of priorities for the topology monitoring connection: strict-writer, strict-reader, writer-or-reader. Default is strict-writer. The monitor accepts any connection initially and asynchronously upgrades to a higher-priority host without blocking the monitoring loop.

    New configuration parameter gdb_monitoring_connection_priority

    GDB-specific extension supporting region-aware values: strict-writer-primary, strict-reader-primary, strict-reader-secondary, strict-writer-<region>, strict-reader-<region>, and plain <region> (any host in that region). Default is strict-writer-primary.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@karenc-bq
karenc-bq force-pushed the chore/gdb-aws-region branch from f849461 to 5ef1cc3 Compare August 6, 2026 01:25
@karenc-bq
karenc-bq force-pushed the chore/gdb-aws-region branch from 5ef1cc3 to fca73dc Compare August 6, 2026 01:53
"Comma-separated, region-aware priority list for the Global Database "
"topology monitor's background connection. Values combine role, region, "
"and primary/secondary awareness, e.g. 'strict-writer-primary', "
"'strict-reader-secondary', 'strict-reader-us-east-1', 'us-west-2'.",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"'strict-reader-secondary', 'strict-reader-us-east-1', 'us-west-2'.",
"'strict-reader-secondary', 'strict-reader-us-east-1', 'us-west-2' ",

Unsure if the period was intentional

self._host_threads_latest_topology: AtomicReference[Optional[Topology]] = AtomicReference(None)

self._is_verified_writer_connection = False
# Retained even after _writer_host_info is cleared; node threads use it

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Retained even after _writer_host_info is cleared; node threads use it
# Retained even after _writer_host_info is cleared; host threads use it

WrapperProperties.CONNECT_TIMEOUT_SEC.set(self._monitoring_properties, self.DEFAULT_CONNECT_TIMEOUT_SEC)

# Handler that manages the priority of the background monitoring
# connection and asynchronously upgrades it to a higher-priority node.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# connection and asynchronously upgrades it to a higher-priority node.
# connection and asynchronously upgrades it to a higher-priority host.

continue

# Item 8: a reader worker observed a writer change while
# some regions are inaccessible. No node thread may be

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# some regions are inaccessible. No node thread may be
# some regions are inaccessible. No host thread may be

"ClusterTopologyMonitor.ExceptionStartingHostMonitor",
self._cluster_id, host_info.host, e)

# Item 8: if node threads never verified a writer (e.g. it

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Item 8: if node threads never verified a writer (e.g. it
# Item 8: if host threads never verified a writer (e.g. it

"ClusterTopologyMonitor.ExceptionStartingHostMonitor",
self._cluster_id, host_info.host, e)

# Item 8: if node threads never verified a writer (e.g. it

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the second Item 8 - is that intentional? If so may I suggest 8a and 8b as titles

self._monitor._update_topology_cache(hosts)

# Item 8: signal a panic-mode exit only when some regions are
# inaccessible. In that case no node thread may be able to reach the

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# inaccessible. In that case no node thread may be able to reach the
# inaccessible. In that case no host thread may be able to reach the

# new writer to confirm it via get_writer_id_if_connected(), so a
# reader-observed writer change is the fastest way out of panic mode.
# When all regions are accessible we defer to the standard exit path
# (a node thread connecting to the new writer reports it directly),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# (a node thread connecting to the new writer reports it directly),
# (a host thread connecting to the new writer reports it directly),

def prepare_conn_props(self, props: Properties):
...

def filter_available_hosts(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar comment to my previous review: I'm curious about the best location for this logic - seems to be quite a bit of duplicated logic around filtering available hosts

| [GDB Failover plugin](./UsingTheGdbFailoverPlugin.md) | Validates the home region at init. In `strict-writer` mode, **fails loudly** (`FailoverFailedError`) if the new writer is in an inaccessible region. In all other modes, filters out inaccessible-region hosts before candidate selection. |
| [GDB Read/Write Splitting plugin](./UsingTheGdbReadWriteSplittingPlugin.md) | Validates the home region at init. Rejects (`ReadWriteSplittingError`) a writer in an inaccessible region. Filters readers by accessible region **before** applying the home-region restriction. |
| Aurora Initial Connection Strategy plugin | Excludes inaccessible-region hosts before selecting a host by strategy. |
| Global Aurora topology monitor | Skips node-monitoring workers for hosts in inaccessible regions, and fails if the initial host is itself in an inaccessible region. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| Global Aurora topology monitor | Skips node-monitoring workers for hosts in inaccessible regions, and fails if the initial host is itself in an inaccessible region. |
| Global Aurora topology monitor | Skips host-monitoring workers for hosts in inaccessible regions, and fails if the initial host is itself in an inaccessible region. |

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants