[CONJ-400] Pool : galera validation Created: 2016-12-09 Updated: 2018-01-03 Resolved: 2017-07-18 |
|
| Status: | Closed |
| Project: | MariaDB Connector/J |
| Component/s: | Failover |
| Affects Version/s: | None |
| Fix Version/s: | 2.1.0 |
| Type: | Task | Priority: | Major |
| Reporter: | Diego Dupin | Assignee: | Diego Dupin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Sprint: | Sprint connector/j 2.1.0 |
| Description |
|
JDBC Connection.valid() implementation execute a COM_PING, indicating that socket is OK. When connecting a Galera server in non-primary state:
When a master become non-primary, a SQLException will be thrown for any INSERT or SELECT (if variable wsrep_dirty_reads is false), problem is all other connection is pool are still considered valid until having these kind of query. Goal is to permit that pool discard those connection with the standard JDBC Connection.valid() verification, and avoid connect to non primary server when driver is configured with multi-master configuration. When driver use multi-master configuration, when establishing the connection, or validating the connection, driver must ensure that if wsrep_cluster_status variable exists, it's set to PRIMARY |
| Comments |
| Comment by Shashi Mall (Inactive) [ 2017-11-28 ] | ||||
|
Hi Diego, Thanks for your work on this issue but I am somewhat confused by the implementation. Firstly, the query used to determine the cluster status does not, in my opinion, return the desired information. Using the mysql client, I see the following: MariaDB [(none)]> select @@wsrep_cluster_status; However, the desired information can be obtained (apologies for the lack of formatting): MariaDB [(none)]> show status like 'wsrep_cluster_status';
---------------------
--------------------- Please let me know where I am going wrong in my analysis. Secondly, this issue was going to deal with the wsrep_ready status variable but this is not implemented in the code and was removed from the description. Can you please explain what happened? | ||||
| Comment by Diego Dupin [ 2017-12-22 ] | ||||
|
Implementation in 2.2.0 was never using the variable wsrep_cluster_status, but standard COM_PING. | ||||
| Comment by Shashi Mall (Inactive) [ 2018-01-03 ] | ||||
|
Hi Diego, Thank you for working on this and I can confirm that the isValid() method is working as described. The implementation certainly ensures that only a connection to a primary component node is considered valid. However, I feel that this is not a comprehensive solution since the wsrep_ready status must also be examined in order to determine if the node can accept queries. Indeed, this was stated in earlier descriptions of this issue. I would be very grateful if you could explain why the decision has been made to not examine the wsrep_ready status. I am sure there must be a good reason but I cannot work it out. |