public class AuroraListener extends MastersSlavesListener
| Modifier and Type | Field and Description |
|---|---|
private java.util.regex.Pattern |
auroraDnsPattern |
private java.lang.String |
clusterDnsSuffix |
private HostAddress |
clusterHostAddress |
private static java.util.logging.Logger |
logger |
masterProtocol, secondaryProtocolwaitNewMasterProtocol, waitNewSecondaryProtocolcurrentConnectionAttempts, currentProtocol, currentReadOnlyAsked, explicitClosed, globalInfo, lastQueryNanos, lastRetry, proxy, urlParser| Constructor and Description |
|---|
AuroraListener(UrlParser urlParser,
GlobalStateInfo globalInfo)
Constructor for Aurora.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
checkMasterStatus(SearchFilter searchFilter)
Check master status.
|
private HostAddress |
findClusterHostAddress(UrlParser urlParser)
Retrieves the cluster host address from the UrlParser instance.
|
HostAddress |
getClusterHostAddress() |
private java.util.List<java.lang.String> |
getCurrentEndpointIdentifiers(Protocol protocol)
Retrieves all endpoints of a cluster from the appropriate database table.
|
void |
reconnectFailedConnection(SearchFilter initialSearchFilter)
Search a valid connection for failed one.
|
void |
retrieveAllEndpointsAndSet(Protocol protocol)
Retrieves the information necessary to add a new endpoint.
|
HostAddress |
searchByStartName(Protocol secondaryProtocol,
java.util.List<HostAddress> loopAddress)
Looks for the current master/writer instance via the secondary protocol if it is found within 3 attempts.
|
private HostAddress |
searchForMasterHostAddress(Protocol protocol,
java.util.List<HostAddress> loopAddress)
Aurora replica doesn't have the master endpoint but the master instance name.
|
private void |
setUrlParserFromEndpoints(java.util.List<java.lang.String> endpoints,
int port)
Sets urlParser accordingly to discovered hosts.
|
checkInitialConnection, checkWaitingConnection, connectedHosts, foundActiveMaster, foundActiveSecondary, getCatalog, getMajorServerVersion, getServerThreadId, getTimeout, handleFailLoop, initializeConnection, invoke, isClosed, isMasterConnected, isMasterConnection, isValid, lockAndSwitchMaster, lockAndSwitchSecondary, noBackslashEscapes, preAbort, preClose, preExecute, primaryFail, prolog, reconnect, removeListenerFromSchedulers, rePrepareOnSlave, reset, secondaryFail, sessionStateAware, switchReadOnlyConnection, versionGreaterOrEqualgetFilterForFailedHost, getSecondaryHostFailNanos, handleFailover, hasHostFail, isMasterHostFailReconnect, isSecondaryHostFail, isSecondaryHostFailReconnect, resetMasterFailoverData, resetSecondaryFailoverData, setSecondaryHostFailabortConnection, addToBlacklist, canRetryFailLoop, clearBlacklist, closeConnection, getBlacklistKeys, getCurrentProtocol, getLastQueryNanos, getMasterHostFailNanos, getProxy, getRetriesAllDown, getUrlParser, invoke, isAutoReconnect, isExplicitClosed, isMasterHostFail, isQueryRelaunchable, isReadOnly, pingMasterProtocol, preAutoReconnect, relaunchOperation, removeFromBlacklist, resetOldsBlackListHosts, setMasterHostFail, setProxy, setSessionReadOnly, syncConnection, throwFailoverMessageprivate static final java.util.logging.Logger logger
private final java.util.regex.Pattern auroraDnsPattern
private final HostAddress clusterHostAddress
private java.lang.String clusterDnsSuffix
public AuroraListener(UrlParser urlParser, GlobalStateInfo globalInfo) throws java.sql.SQLException
urlParser - connection informationglobalInfo - server global variables informationjava.sql.SQLException - when connection string contain host with different clusterprivate HostAddress findClusterHostAddress(UrlParser urlParser) throws java.sql.SQLException
urlParser - object that holds the connection informationjava.sql.SQLExceptionpublic HostAddress getClusterHostAddress()
public void reconnectFailedConnection(SearchFilter initialSearchFilter) throws java.sql.SQLException
reconnectFailedConnection in interface ListenerreconnectFailedConnection in class MastersSlavesListenerinitialSearchFilter - initial search filterjava.sql.SQLException - if a connection asked is not foundpublic void retrieveAllEndpointsAndSet(Protocol protocol) throws java.sql.SQLException
protocol - current protocol connected tojava.sql.SQLException - if connection error occurprivate java.util.List<java.lang.String> getCurrentEndpointIdentifiers(Protocol protocol) throws java.sql.SQLException
protocol - current protocol connected tojava.sql.SQLException - if connection error occurprivate void setUrlParserFromEndpoints(java.util.List<java.lang.String> endpoints,
int port)
endpoints - instance identifiersport - port that is common to all endpointspublic HostAddress searchByStartName(Protocol secondaryProtocol, java.util.List<HostAddress> loopAddress)
secondaryProtocol - the current secondary protocolloopAddress - list of possible hostsprivate HostAddress searchForMasterHostAddress(Protocol protocol, java.util.List<HostAddress> loopAddress) throws java.sql.SQLException
protocol - current protocolloopAddress - list of possible hostsjava.sql.SQLException - if any connection error occurpublic boolean checkMasterStatus(SearchFilter searchFilter)
MastersSlavesListenercheckMasterStatus in interface ListenercheckMasterStatus in class MastersSlavesListenersearchFilter - search filter