Bug #75211 ConnectorJ doesn't switch to new master with MySQL Fabric
Submitted: 15 Dec 2014 6:17 Modified: 10 Apr 2015 10:10
Reporter: Nabeel Bukhari Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:5.1.34 OS:Any
Assigned to: CPU Architecture:Any
Tags: Connector/J, fabric

[15 Dec 2014 6:17] Nabeel Bukhari
Description:
I am configuring MySQL Fabric with WebLogic 12c and Connector/J 5.1.34. On Failover, ConnectorJ doesn't switch to new master while Fabric shows the new master.

How to repeat:
I have followed steps and found out Connector/J doesn't switch to new master. 

1. I have created a fabric group with two servers one is MASTER (Primary - read-write mode ) and Slave (Secondary - Read only mode) 

2. After that I have stopped MASTER (Primary) and now Slave is a new MASTER 

3. Later I started original MASTER , and I can see status as FAULTY 

4. Try to fetch some data. The JPA/EclipseLink will never return and driver will keep trying the query to faulty server. 

I have verified it with Wireshark. The driver queries Fabric Server continuously and get information about new server but cannot use it.

Suggested fix:
I made two changes in FabricMySQLConnectionProxy class.

First in method interceptException where I moved the following code:

this.serverConnections.remove(this.serverGroup);
try {
	this.currentConnection.close();
} catch (SQLException ex) {
}
this.currentConnection = null;
this.serverGroup = currentGroup;

inside this check
 

if (currentServer == null) {
	return SQLError.createSQLException("Unable to lookup server to report error to Fabric", sqlEx.getSQLState(), sqlEx, getExceptionInterceptor(),
			this);
}

Secondly, 
I commented the following line.

info.put("replicationConnectionGroup", this.serverGroup.getName());

As we are not using any API to add or remove slaves so I thought, it might be save to not define replication group..
[15 Dec 2014 6:18] Nabeel Bukhari
The severity is critical as application will fail.
[10 Apr 2015 10:12] Chiranjeevi Battula
Hello Nabeel Bukhari,

Thank you for the bug report.
This is duplicate of Bug #75113.

Thanks,
Chiranjeevi.