Description:
I have set up one backing store, one master database, and one slave database.
If both Master and Slave DB are up, everything go fine.
However, when I take down the Master, Fabric promoted the slave to the new Master, the client cannot read and write through Fabric. It seems that Fabric cannot update the cached route in the client's MySQL connector.
How to repeat:
1.Set up one backing store, one master database, and one slave database.
2.Start both Master and Slave DB;
3.Take down the Master, Fabric promoted the slave to the new Master
4.the client cannot read and write through Fabric.
Suggested fix:
There are something wrong in the method,com.mysql.jdbc.ReplicationConnectionGroup.registerReplicationConnection().
public long registerReplicationConnection(ReplicationConnection conn, List<String> localMasterList, List<String> localSlaveList) {
long currentConnectionId;
synchronized (this) {
if (!this.isInitialized) {
if (localMasterList != null) {
this.masterHostList.addAll(localMasterList);
}
if (localSlaveList != null) {
this.slaveHostList.addAll(localSlaveList);
}
this.isInitialized = true;
}
currentConnectionId = ++this.connections;
this.replicationConnections.put(Long.valueOf(currentConnectionId), conn);
}
this.activeConnections++;
return currentConnectionId;
}
This method can't change anything when fabric changed the master node.