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..