[ 
https://issues.apache.org/jira/browse/OPENJPA-2943?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18141807#comment-18141807
 ] 

ASF subversion and git services commented on OPENJPA-2943:
----------------------------------------------------------

Commit ccfde5ac1803a619c882eed5dd8f788b4196e830 in openjpa's branch 
refs/heads/OPENJPA-2943 from Richard Zowalla
[ https://gitbox.apache.org/repos/asf?p=openjpa.git;h=ccfde5ac1 ]

[OPENJPA-2943] Detect replication connections of modern MySQL Connector/J

MySQLDictionary.decorate() only started a connection read-only, so that
reads go to a replica, when the configured driver was
com.mysql.jdbc.ReplicationDriver, which Connector/J 8 removed. A
replication connection is now also recognized by its
jdbc:mysql:replication: (or jdbc:mysql+srv:replication:) URL and by
being a wrapper for Connector/J's ReplicationConnection, looked up by
name so there is no compile time dependency on the driver.


> MySQLDictionary.decorate() is out of date with MySQL Driver Changes
> -------------------------------------------------------------------
>
>                 Key: OPENJPA-2943
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2943
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>            Reporter: Jody Grassel
>            Priority: Major
>
> MySQLDictionary.decorate() has a check to determine if the MySQL driver is of 
> type "com.mysql.jdbc.ReplicationDriver" (for utilizing read-only replica 
> nodes to relieve read-work on the primary database) – if it is, then it calls 
> conn.setReadOnly(true).  This is to ensure that, by default, reads are going 
> to the reader nodes, instead of the writer nodes.
> Later versions of the MySQL Connect J driver (as of v8) have done away with 
> the "com.mysql.jdbc.ReplicationDriver" class (see 
> [https://dev.mysql.com/doc/connector-j/en/connector-j-other-changes.html 
> section|https://dev.mysql.com/doc/connector-j/en/connector-j-other-changes.html,]).
> This means the current means of detecting whether the environment is using 
> read-replicas is no longer valid, and needs to be updated to support more 
> modern versions of Connect J.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to