public class AuroraListener extends MastersReplicasListener
| 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 |
hostAddresses, 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()
Retrieves the cluster host address from the UrlParser instance.
|
java.lang.String |
getClusterDnsSuffix() |
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, inTransaction, invoke, isClosed, isMasterConnected, isMasterConnection, isServerMariaDb, isValid, lockAndSwitchMaster, lockAndSwitchSecondary, noBackslashEscapes, preAbort, preClose, preExecute, primaryFail, prolog, reconnect, removeListenerFromSchedulers, rePrepareOnReplica, 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() throws java.sql.SQLException
java.sql.SQLExceptionpublic java.lang.String getClusterDnsSuffix()
public HostAddress getClusterHostAddress()
public void reconnectFailedConnection(SearchFilter initialSearchFilter) throws java.sql.SQLException
reconnectFailedConnection in interface ListenerreconnectFailedConnection in class MastersReplicasListenerinitialSearchFilter - 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)
MastersReplicasListenercheckMasterStatus in interface ListenercheckMasterStatus in class MastersReplicasListenersearchFilter - search filter