Skip to content
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

Modified reg-ex patterns to match Aurora's read-only endpoints #146

Closed
wants to merge 3 commits into from

Conversation

timr
Copy link
Contributor

@timr timr commented Aug 23, 2019

This PR allows the driver to discover and connect to other servers within an Aurora cluster when a read-only cluster endpoint is used. A read-only cluster endpoint used in the JDBC url for multi-region / single master deployments where a region may only have read replicas. Read-only cluster endpoints contain "cluster-ro-" in there names instead of "cluster-" for master clusters.

RO: my-aurora-cluster-1.cluster-ro-muca838tbv0q.us-west-2.rds.amazonaws.com
RW: my-aurora-cluster-1.cluster-muca838tbv0q.us-west-2.rds.amazonaws.com

@timr timr marked this pull request as ready for review August 23, 2019 21:46
@rusher
Copy link
Collaborator

rusher commented Oct 10, 2019

Hi, this would need lots more change.
Actual aurora implementation creates 2 underlying connections: one to the writer, one to a reader.
Regex would permit to connect a reader, but the driver will check read/write server state and try indefinitely to connect the master.

Connecting only to read server can be done using standard connection string 'jdbc:mariadb://<some.cluster-ro.region.rds.amazonaws.com>/db' or 'jdbc:mariadb:loadbalance://reader1,reader2,...readerX/db'

The first one has the advantage of using new readers added immediately.

@timr
Copy link
Contributor Author

timr commented Nov 19, 2019

Hi, this would need lots more change.
Actual aurora implementation creates 2 underlying connections: one to the writer, one to a reader.
Regex would permit to connect a reader, but the driver will check read/write server state and try indefinitely to connect the master.

Connecting only to read server can be done using standard connection string 'jdbc:mariadb://<some.cluster-ro.region.rds.amazonaws.com>/db' or 'jdbc:mariadb:loadbalance://reader1,reader2,...readerX/db'

The first one has the advantage of using new readers added immediately.

Hi @rusher,

The first example you highlighted near the end is the condition I'm trying to fix. I've added unit tests to help demonstrate the issue.

  • Tim

@timr
Copy link
Contributor Author

timr commented Apr 30, 2020

Going to revisit this a different way.

@timr timr closed this Apr 30, 2020
@timr timr deleted the read-only-aurora branch April 30, 2020 14:52
@plebedev
Copy link

plebedev commented Jun 1, 2020

Does it support aurora mode in the connection string, like
jdbc:mariadb:aurora://<some.cluster-ro.region.rds.amazonaws.com>/db ?

We've tried it and got

Caused by: java.sql.SQLException: Communications link failure with primary. No active connection found for master.
at org.mariadb.jdbc.internal.failover.AbstractMastersListener.throwFailoverMessage(AbstractMastersListener.java:563) ~[mariadb-java-client-2.6.0.jar:?]
at org.mariadb.jdbc.internal.failover.impl.MastersSlavesListener.checkInitialConnection(MastersSlavesListener.java:350) ~[mariadb-java-client-2.6.0.jar:?]
at org.mariadb.jdbc.internal.failover.impl.MastersSlavesListener.initializeConnection(MastersSlavesListener.java:179) ~[mariadb-java-client-2.6.0.jar:?]
at org.mariadb.jdbc.internal.failover.FailoverProxy.<init>(FailoverProxy.java:120) ~[mariadb-java-client-2.6.0.jar:?]
at org.mariadb.jdbc.internal.util.Utils.retrieveProxy(Utils.java:607) ~[mariadb-java-client-2.6.0.jar:?]
at org.mariadb.jdbc.MariaDbConnection.newConnection(MariaDbConnection.java:150) ~[mariadb-java-client-2.6.0.jar:?]
at org.mariadb.jdbc.MariaDbDataSource.getConnection(MariaDbDataSource.java:275) ~[mariadb-java-client-2.6.0.jar:?]
at org.mariadb.jdbc.MariaDbDataSource.getXAConnection(MariaDbDataSource.java:453) ~[mariadb-java-client-2.6.0.jar:?]
at com.atomikos.jdbc.AtomikosXAConnectionFactory.createPooledConnection(AtomikosXAConnectionFactory.java:43) ~[transactions-jdbc-4.0.6.jar:?]
... 24 more


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants