Skip to content

Conversation

@faviansamatha
Copy link
Contributor

Description

Currently, we can run into the following condition:

conn: Connection = connect_func()  # conn is connected to `reader` because dsn hasn't resolved

cluster_inet_address: Optional[str] = None
try:
    cluster_inet_address = socket.gethostbyname(host_info.host) # dsn resolved to writer and now cluster_inet_address is correct
except socket.gaierror:
    pass
            

When this happens, we see that the current connection is a reader; however, we do not switch the connection because the cluster_inet_address == writer_host_address (since it resolves).

This PR adds a check to make sure that if we are connected to a reader, we will attempt to connect to a writer host.

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

@faviansamatha faviansamatha merged commit b10a3a2 into main Jan 29, 2026
13 of 15 checks passed
@faviansamatha faviansamatha deleted the fix/stale_dns_plugin branch January 29, 2026 20:21
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