-
Notifications
You must be signed in to change notification settings - Fork 45
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
Driver not failing over to readers #1075
Comments
My initial thoughts after some more debugging, is that this is possibly happening in this scenario:
My priority is always for reader connections, with fast failover, over writers. So maybe my solution here is that I need to configure my read and write data sources independently, rather then read/write splitting? |
Hi @Milesy, thank you for submitting this ticket. We are looking into this to try and understand what is occurring and how we can find a good solution for you. For starters, can you please confirm the following?
|
@aaron-congo Good Morning arron. I have tried multiple configuration setups. This setup was against the cluster end point, with read-write splitting in place. But in my view now, the read-write splitting is too much overhead with the constant swapping back and forward of connections. My primary use case is to support read operations during a failover, so this is where I am trying to concentrate my efforts. The cluster is made up of 4 nodes, across two AZs. Node 0 and 2 are on us-east-1c, and Node 1 and 3 are on us-east-1d I dont see a log entry saying failoverReader or failoverWriter With some tweaking I have a different scenarios. (Connecting to RO end point just now)
|
Hi @Milesy, Thank you for the information. You are correct that the read/write splitting plugin regularly switches between the writer/reader when using Spring's It sounds like you are now using the driver without the read/write splitting plugin. Under this new driver configuration, can you clarify what behavior you are seeing that is unexpected and that you would like to fix? Additionally, can you please tell me if you are using the read/write splitting plugin and/or internal connection pools for point "2." in your recent response? The beginning of your response makes it sound like you are not using the read/write plugin, but in point "2." you mention failure is detected within the Hikari internal pool, and internal connection pools is a read/write splitting plugin feature. |
Bit of an update: I've chatted with @Milesy and he is no longer using the read/write splitting plugin because spring automatically calls setReadOnly before/after each transaction. However, he did encounter a scenario which was problematic for him: if using internal connection pools and AwsWrapperDataSource#getConnection is called while server failover is occurring, the driver does not fail over because:
The solution to this issue is to:
|
Hi @Milesy, I believe we have addressed the original issue, which turned out to be that failover was not occurring on connect. Are you okay with me closing this ticket? If I don't hear anything in the next few days I will go ahead and do so, but please feel free to reopen it or let me know if you encounter any other problems. Thanks! |
That’s all great with me Aaron. It’s been great to get to the bottom of this and thank you for the engagement.
Chris
… On 24 Oct 2024, at 21:10, Aaron ***@***.***> wrote:
Hi @Milesy, I believe we have addressed the original issue, which turned out to be that failover was not occurring on connect. Are you okay with me closing this ticket? If I don't hear anything in the next few days I will go ahead and do so, but please feel free to reopen it or let me know if you encounter any other problems. Thanks!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.
|
Describe the bug
When doing a failover of a writer, readonly connections are not failing over to the available readers. The failover takes approx 20 seconds while it waits on the new writer node starting up.
Expected Behavior
I expect, the failover to happen within seconds, and my read-only transactions to be split to the reader nodes.
What plugins are used? What other connection properties were set?
ConnectTimeConnectionPluginFactory,ExecutionTimeConnectionPluginFactory,IamAuthConnectionPluginFactory,AuroraInitialConnectionStrategyPluginFactory,AuroraConnectionTrackerPluginFactory,ReadWriteSplittingPluginFactory,FailoverConnectionPluginFactory,HostMonitoringConnectionPluginFactory
Current Behavior
Using the driver with Postgres Aurora Serverless, I have configured failover, with internal connection pooling, with read-write splitting enabled.
I have also set the failover mode to STRICT_READER (can be seen in the logs), and my tests are all against read only connections (can also be seen in the logs)
I have 1 WRITER and 3 READERSs.
Whenever I failover, the WRITER always fails to node 2, and back to node 0. never any other nodes.
However during failover, my read only connections still appear to follow the failover of the WRITER repeatedly every single time.
When I fail node 0, and node 2 then takes up the WRITER the following is seen in the logs:
And this just happens on a loop for about 20 seconds until the new WRITER is back up and then my transactions continue as normal.
Right to the last moment the node is still starting
Back up, and node 2 is now the writer
Reproduction Steps
Unable to provide at present due to internal policy.
Possible Solution
No response
Additional Information/Context
No response
The AWS Advanced JDBC Driver version used
2.3.7
JDK version used
17
Operating System and version
Windows Server
The text was updated successfully, but these errors were encountered: