Skip to content

Commit

Permalink
[failover] assure that master connection initialization is always valid
Browse files Browse the repository at this point in the history
  • Loading branch information
rusher committed Jan 12, 2016
1 parent 01ff2ef commit 9f0b051
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 19 deletions.
Expand Up @@ -140,16 +140,20 @@ public void reconnectFailedConnection(SearchFilter searchFilter) throws QueryExc

if ((isMasterHostFail() || isSecondaryHostFail())
|| searchFilter.isInitialConnection()) {
AuroraProtocol.loop(this, loopAddress, searchFilter);
if (!searchFilter.isFailoverLoop()) {
try {
checkWaitingConnection();
} catch (ReconnectDuringTransactionException e) {
//don't throw an exception for this specific exception
//while permit to avoid case when succeeded creating a new Master connection
//and ping master connection fail a few millissecond after,
//resulting a masterConnection not initialized.
do {
AuroraProtocol.loop(this, loopAddress, searchFilter);
if (!searchFilter.isFailoverLoop()) {
try {
checkWaitingConnection();
} catch (ReconnectDuringTransactionException e) {
//don't throw an exception for this specific exception
}
}
}
} while (searchFilter.isInitialConnection() && masterProtocol == null);
}

}


Expand Down
Expand Up @@ -303,15 +303,20 @@ public void reconnectFailedConnection(SearchFilter searchFilter) throws QueryExc

if ((isMasterHostFail() || isSecondaryHostFail())
|| searchFilter.isInitialConnection()) {
MastersSlavesProtocol.loop(this, loopAddress, searchFilter);
//close loop if all connection are retrieved
if (!searchFilter.isFailoverLoop()) {
try {
checkWaitingConnection();
} catch (ReconnectDuringTransactionException e) {
//don't throw an exception for this specific exception
//while permit to avoid case when succeeded creating a new Master connection
//and ping master connection fail a few millissecond after,
//resulting a masterConnection not initialized.
do {
MastersSlavesProtocol.loop(this, loopAddress, searchFilter);
//close loop if all connection are retrieved
if (!searchFilter.isFailoverLoop()) {
try {
checkWaitingConnection();
} catch (ReconnectDuringTransactionException e) {
//don't throw an exception for this specific exception
}
}
}
} while (searchFilter.isInitialConnection() && masterProtocol == null);
}

}
Expand Down
@@ -1,10 +1,10 @@
package org.mariadb.jdbc.internal.util.constant;

public final class Version {
public static final String version = "1.3.4";
public static final String version = "1.3.5-SNAPSHOT";
public static final int majorVersion = 1;
public static final int minorVersion = 3;
public static final int patchVersion = 4;
public static final String qualifier = "";
public static final int patchVersion = 5;
public static final String qualifier = "SNAPSHOT";

}

0 comments on commit 9f0b051

Please sign in to comment.