Skip to content

Conversation

@faviansamatha
Copy link
Contributor

@faviansamatha faviansamatha commented Jan 20, 2026

Description

  • Fixed bug when switching to writer or reader in read/write splitting after host is not in allowed list of hosts in custom endpoint
  • Split custom endpoint test with read write splitting into 2 in order to ensure that we always test both paths.
  • Added AWS secrets manager failover parameter to fix flakey test

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

@faviansamatha faviansamatha force-pushed the fix/read-write-splitting-no-writer branch from 9217b12 to f3c0000 Compare January 20, 2026 20:07
conn.read_only = False

writer_id = rds_utils.get_cluster_writer_instance_id()
new_member = writer_id
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we assign writer_id to new_member? the following lines are actually clearer if you keep the name writer_id?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, I just deleted the code path from the if else condition as the original, will change it to improve readability

Comment on lines 284 to 285
# We should not be able to switch again because new_member was removed from the custom endpoint.
# We are connected to the reader. Attempting to switch to the writer will throw an exception.
Copy link
Contributor

Choose a reason for hiding this comment

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

To clarify:

  • reconnected back to the original reader instance on line 277
  • removed the original reader instance from the custom endpoint
  • now switching to the writer instance (a valid member of the endpoint) errors out

This is because the current reader connection is invalid? Wouldn't any operation fail?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So:

  1. Connected to reader node, readOnly=False should fail since writer is not in allowed list
  2. Add writer and then switch to Writer so it should be good,
  3. Switch back to reader (readOnly=True), then remove writer (not original reader)
  4. Now try to switch to Writer and it should fail.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll add something like this in the beginning of each test so it's more descriptive, and will change the variable names

@faviansamatha faviansamatha force-pushed the fix/read-write-splitting-no-writer branch from f3c0000 to 349ef26 Compare January 20, 2026 22:05
faviansamatha and others added 2 commits January 20, 2026 14:38
Co-authored-by: Sophia Chu <112967780+sophia-bq@users.noreply.github.com>
@faviansamatha faviansamatha merged commit 22a2610 into main Jan 22, 2026
13 of 15 checks passed
@faviansamatha faviansamatha deleted the fix/read-write-splitting-no-writer branch January 22, 2026 00:06
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.

3 participants