Skip to content

Commit

Permalink
CONJ-623 / Increase connection logging when Primary node connection f…
Browse files Browse the repository at this point in the history
…ails

(cherry picked from commit d4fcfbe)
  • Loading branch information
Federico Gaule authored and rusher committed Feb 4, 2019
1 parent b4c4c4d commit 9f91ca4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,12 @@ public HandleErrorResult handleFailover(SQLException qe, Method method, Object[]
throw new SQLException("Connection has been closed !");
}
if (setMasterHostFail()) {
logger.warn("SQL Primary node [{}, conn={}] connection fail. Reason : {}",
this.currentProtocol.getHostAddress().toString(),
this.currentProtocol.getServerThreadId(),
qe.getMessage());
logger.warn("SQL Primary node [{}, conn={}, local_port={}, timeout={}] connection fail. Reason : {}",
this.currentProtocol.getHostAddress().toString(),
this.currentProtocol.getServerThreadId(),
this.currentProtocol.getSocket().getLocalPort(),
this.currentProtocol.getTimeout(),
qe.getMessage());
addToBlacklist(currentProtocol.getHostAddress());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1326,6 +1326,11 @@ public long getServerThreadId() {
return serverThreadId;
}

@Override
public Socket getSocket() {
return socket;
}

public boolean isExplicitClosed() {
return explicitClosed;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@

import java.io.IOException;
import java.io.InputStream;
import java.net.Socket;
import java.net.SocketException;
import java.nio.charset.Charset;
import java.sql.SQLException;
Expand Down Expand Up @@ -199,6 +200,8 @@ boolean executeBatchServer(boolean mustExecuteOnMaster, ServerPrepareResult serv

long getServerThreadId();

Socket getSocket();

void setTransactionIsolation(int level) throws SQLException;

int getTransactionIsolationLevel();
Expand Down

0 comments on commit 9f91ca4

Please sign in to comment.