public class AuroraProtocol extends MastersSlavesProtocol
masterConnection
readScheduler
activeStreamingResult, autoIncrementIncrement, connected, database, eofDeprecated, explicitClosed, hasWarnings, lock, options, proxy, reader, readOnly, serverCapabilities, serverPrepareStatementCache, serverStatus, serverThreadId, socket, urlParser, writer
Constructor and Description |
---|
AuroraProtocol(UrlParser url,
GlobalStateInfo globalInfo,
java.util.concurrent.locks.ReentrantLock lock) |
Modifier and Type | Method and Description |
---|---|
boolean |
checkIfMaster()
Aurora best way to check if a node is a master : is not in read-only mode.
|
static AuroraProtocol |
getNewProtocol(FailoverProxy proxy,
GlobalStateInfo globalInfo,
UrlParser urlParser)
Initialize new protocol instance.
|
boolean |
isMasterConnection()
Indicate if current protocol is a master protocol.
|
boolean |
isValid(int timeout)
Check that connection is valid.
|
static void |
loop(AuroraListener listener,
GlobalStateInfo globalInfo,
java.util.List<HostAddress> addresses,
SearchFilter initialSearchFilter)
loop until found the failed connection.
|
void |
readPipelineCheckMaster() |
private static void |
resetHostList(AuroraListener listener,
java.util.Deque<HostAddress> loopAddresses)
Reinitialize loopAddresses with all hosts : all servers in randomize order with cluster
address.
|
private static void |
searchProbableMaster(AuroraListener listener,
GlobalStateInfo globalInfo,
HostAddress probableMaster)
Connect aurora probable master.
|
foundMaster, foundSecondary, loop, mustBeMasterConnection, setMustBeMasterConnection
loop
addPrepareInCache, cancelCurrentQuery, closeExplicit, executeBatchClient, executeBatchServer, executeBatchStmt, executePreparedQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, forceReleasePrepareStatement, forceReleaseWaitingPrepareStatement, getAutocommit, getAutoIncrementIncrement, getCatalog, getMaxRows, getResult, getTimeout, getTransactionIsolationLevel, handleIoException, interrupt, inTransaction, isInterrupted, ping, prepare, prolog, prologProxy, releasePrepareStatement, reset, resetDatabase, resetStateAfterFailover, rollback, setActiveFutureTask, setCatalog, setLocalInfileInputStream, setMaxRows, setTimeout, setTransactionIsolation, stopIfInterrupted
abort, changeSocketSoTimeout, changeSocketTcpNoDelay, close, connect, connectWithoutProxy, getActiveStreamingResult, getDatabase, getHost, getHostAddress, getLock, getMajorServerVersion, getMinorServerVersion, getOptions, getPinGlobalTxToPhysicalConnection, getPort, getProxy, getReader, getReadonly, getServerThreadId, getServerVersion, getSocket, getTimeZone, getTraces, getUrlParser, getUsername, getWriter, hasMoreResults, hasWarnings, isClosed, isConnected, isEofDeprecated, isExplicitClosed, isServerMariaDb, noBackslashEscapes, prepareStatementCache, readEofPacket, removeActiveStreamingResult, removeHasMoreResults, sessionStateAware, setActiveStreamingResult, setHasWarnings, setHostAddress, setHostFailedWithoutProxy, setProxy, setReadonly, setServerStatus, shouldReconnectWithoutProxy, skip, skipEofPacket, versionGreaterOrEqual
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
abort, changeSocketSoTimeout, changeSocketTcpNoDelay, close, connect, connectWithoutProxy, getActiveStreamingResult, getDatabase, getHost, getHostAddress, getLock, getMajorServerVersion, getMinorServerVersion, getOptions, getPinGlobalTxToPhysicalConnection, getPort, getProxy, getReader, getReadonly, getServerThreadId, getServerVersion, getSocket, getTimeZone, getTraces, getUrlParser, getUsername, getWriter, hasMoreResults, hasWarnings, isClosed, isConnected, isEofDeprecated, isExplicitClosed, isServerMariaDb, noBackslashEscapes, prepareStatementCache, readEofPacket, removeActiveStreamingResult, removeHasMoreResults, sessionStateAware, setActiveStreamingResult, setHasWarnings, setHostAddress, setHostFailedWithoutProxy, setProxy, setReadonly, setServerStatus, shouldReconnectWithoutProxy, skip, skipEofPacket, versionGreaterOrEqual
public AuroraProtocol(UrlParser url, GlobalStateInfo globalInfo, java.util.concurrent.locks.ReentrantLock lock)
private static void searchProbableMaster(AuroraListener listener, GlobalStateInfo globalInfo, HostAddress probableMaster)
listener
- aurora failover to call back if master is foundglobalInfo
- server global variables informationprobableMaster
- probable master hostpublic static void loop(AuroraListener listener, GlobalStateInfo globalInfo, java.util.List<HostAddress> addresses, SearchFilter initialSearchFilter) throws java.sql.SQLException
listener
- current failoverglobalInfo
- server global variables informationaddresses
- list of HostAddress to loopinitialSearchFilter
- search parameterjava.sql.SQLException
- if not foundprivate static void resetHostList(AuroraListener listener, java.util.Deque<HostAddress> loopAddresses)
listener
- current listenerloopAddresses
- the list to reinitializepublic static AuroraProtocol getNewProtocol(FailoverProxy proxy, GlobalStateInfo globalInfo, UrlParser urlParser)
proxy
- proxyglobalInfo
- server global variables informationurlParser
- connection string data'spublic boolean isMasterConnection()
AbstractConnectProtocol
isMasterConnection
in interface Protocol
isMasterConnection
in class AbstractConnectProtocol
public void readPipelineCheckMaster() throws java.sql.SQLException
readPipelineCheckMaster
in class AbstractConnectProtocol
java.sql.SQLException
public boolean isValid(int timeout) throws java.sql.SQLException
AbstractQueryProtocol
isValid
in interface Protocol
isValid
in class AbstractQueryProtocol
timeout
- timeout in millisecondsjava.sql.SQLException
- if any error occurpublic boolean checkIfMaster() throws java.sql.SQLException
checkIfMaster
in interface Protocol
checkIfMaster
in class AbstractConnectProtocol
java.sql.SQLException
- if requesting infos for server fail.