public class BlueGreenStatusProvider
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
BlueGreenStatusProvider.PhaseTimeInfo |
| Modifier and Type | Field and Description |
|---|---|
protected java.util.concurrent.atomic.AtomicBoolean |
allGreenNodesChangedName |
static AwsWrapperProperty |
BG_DROP_BLUE_CONNECTIONS |
static AwsWrapperProperty |
BG_INTERVAL_BASELINE_MS |
static AwsWrapperProperty |
BG_INTERVAL_HIGH_MS |
static AwsWrapperProperty |
BG_INTERVAL_INCREASED_MS |
static AwsWrapperProperty |
BG_SWITCHOVER_TIMEOUT_MS |
protected java.lang.String |
bgdId |
protected boolean |
blueConnectionsDropped |
protected boolean |
blueDnsUpdateCompleted |
protected java.lang.String |
clusterId |
protected java.util.Map<java.lang.String,Pair<HostSpec,HostSpec>> |
correspondingNodes |
protected boolean |
dropBlueConnectionsSetting |
protected boolean |
greenDnsRemoved |
protected java.util.Map<java.lang.String,java.time.Instant> |
greenNodeChangeNameTimes |
protected boolean |
greenTopologyChanged |
protected java.util.concurrent.atomic.AtomicBoolean |
greenTopologyRecognizedLogged |
protected java.util.Map<java.lang.String,java.util.Optional<java.lang.String>> |
hostIpAddresses |
protected HostSpecBuilder |
hostSpecBuilder |
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
iamHostSuccessfulConnects |
protected @Nullable BlueGreenInterimStatus[] |
interimStatuses |
protected int[] |
interimStatusHashes |
protected int |
lastContextHash |
protected BlueGreenPhase |
latestStatusPhase |
protected java.util.concurrent.atomic.AtomicBoolean |
monitorResetOnInProgressCompleted |
protected java.util.concurrent.atomic.AtomicBoolean |
monitorResetOnTopologyCompleted |
protected @Nullable BlueGreenStatusMonitor[] |
monitors |
protected java.util.Map<java.lang.String,BlueGreenStatusProvider.PhaseTimeInfo> |
phaseTimeNano |
protected PluginService |
pluginService |
protected long |
postStatusEndTimeNano |
protected ResourceLock |
processStatusLock |
protected java.util.Properties |
props |
protected RdsUtils |
rdsUtils |
protected java.util.Map<java.lang.String,BlueGreenRole> |
roleByHost |
protected boolean |
rollback |
protected FullServicesContainer |
servicesContainer |
protected java.util.Map<BlueGreenIntervalRate,java.lang.Long> |
statusCheckIntervalMap |
protected StorageService |
storageService |
protected @Nullable BlueGreenStatus |
summaryStatus |
protected long |
switchoverTimeoutNano |
protected @Nullable OpenedConnectionTracker |
tracker |
| Constructor and Description |
|---|
BlueGreenStatusProvider(@NonNull FullServicesContainer servicesContainer,
@NonNull java.util.Properties props,
@NonNull java.lang.String bgdId,
@NonNull java.lang.String clusterId) |
| Modifier and Type | Method and Description |
|---|---|
protected java.util.List<ConnectRouting> |
addSubstituteBlueWithIpAddressConnectRouting() |
protected void |
checkSwitchoverTimerExpiry()
Checks if the switchover timer has expired while the plugin is still in an active switchover
phase (IN_PROGRESS or POST).
|
protected void |
createPostRouting(java.util.List<ConnectRouting> connectRouting) |
protected void |
dropBlueConnections() |
protected static java.util.List<java.lang.String> |
formatTwoColumnRows(java.util.List<java.lang.String[]> rows)
Formats a list of two-element rows into aligned, indented columns.
|
protected int |
getContextHash() |
protected java.lang.String |
getHostAndPort(java.lang.String host,
int port) |
protected java.util.Properties |
getMonitoringProperties() |
protected long |
getNanoTime()
For testing purposes.
|
protected @Nullable java.util.List<HostSpec> |
getReaderHosts(BlueGreenRole role) |
protected BlueGreenStatus |
getStatusOfCompleted() |
protected BlueGreenStatus |
getStatusOfCreated() |
protected BlueGreenStatus |
getStatusOfInProgress()
New connect requests to blue: suspend or route to corresponding IP address (depending on settings).
|
protected BlueGreenStatus |
getStatusOfPost() |
protected BlueGreenStatus |
getStatusOfPreparation()
New connect requests to blue: route to corresponding IP address.
|
protected int |
getValueHash(int currentHash,
java.lang.String val) |
protected @Nullable HostSpec |
getWriterHost(BlueGreenRole role) |
protected void |
initMonitoring() |
protected boolean |
isAlreadySuccessfullyConnected(java.lang.String connectHost,
java.lang.String iamHost) |
protected boolean |
isSwitchoverTimerExpired() |
protected void |
logCurrentContext() |
protected void |
logGreenTopologyRecognized()
Emits a concise, operationally useful readiness event once the plugin has recognized the
target green topology for the configured
bgdId. |
protected void |
logSwitchoverFinalSummary() |
protected void |
prepareStatus(@NonNull BlueGreenRole role,
@NonNull BlueGreenInterimStatus interimStatus) |
protected void |
registerIamHost(java.lang.String connectHost,
java.lang.String iamHost) |
protected void |
resetContextWhenCompleted() |
protected void |
resetMonitors(java.util.concurrent.atomic.AtomicBoolean monitorResetCompleted,
java.lang.String eventName) |
protected void |
startSwitchoverTimer() |
protected void |
storeBlueDnsUpdateTime() |
protected void |
storeGreenDnsRemoveTime() |
protected void |
storeGreenNodeChangeNameTime() |
protected void |
storeGreenTopologyChangeTime() |
protected void |
storeMonitorResetTime(java.lang.String eventName) |
protected void |
storePhaseTime(BlueGreenPhase phase) |
protected void |
updateCorrespondingNodes()
Update corresponding nodes
Blue writer node is mapped to a green writer node.
|
protected void |
updateDnsFlags(BlueGreenRole role,
BlueGreenInterimStatus interimStatus) |
protected void |
updateMonitors() |
protected void |
updatePhase(BlueGreenRole role,
BlueGreenInterimStatus interimStatus) |
protected void |
updateStatusCache() |
protected void |
updateSummaryStatus(BlueGreenRole role,
BlueGreenInterimStatus interimStatus) |
public static final AwsWrapperProperty BG_INTERVAL_BASELINE_MS
public static final AwsWrapperProperty BG_INTERVAL_INCREASED_MS
public static final AwsWrapperProperty BG_INTERVAL_HIGH_MS
public static final AwsWrapperProperty BG_SWITCHOVER_TIMEOUT_MS
public static final AwsWrapperProperty BG_DROP_BLUE_CONNECTIONS
protected final HostSpecBuilder hostSpecBuilder
protected final @Nullable BlueGreenStatusMonitor[] monitors
protected int[] interimStatusHashes
protected int lastContextHash
protected @Nullable BlueGreenInterimStatus[] interimStatuses
protected final java.util.Map<java.lang.String,java.util.Optional<java.lang.String>> hostIpAddresses
protected final java.util.Map<java.lang.String,Pair<HostSpec,HostSpec>> correspondingNodes
protected final java.util.Map<java.lang.String,BlueGreenRole> roleByHost
protected final java.util.Map<java.lang.String,java.util.Set<java.lang.String>> iamHostSuccessfulConnects
protected final java.util.Map<java.lang.String,java.time.Instant> greenNodeChangeNameTimes
protected @Nullable BlueGreenStatus summaryStatus
protected BlueGreenPhase latestStatusPhase
protected boolean rollback
protected boolean blueDnsUpdateCompleted
protected boolean greenDnsRemoved
protected boolean greenTopologyChanged
protected java.util.concurrent.atomic.AtomicBoolean monitorResetOnInProgressCompleted
protected java.util.concurrent.atomic.AtomicBoolean monitorResetOnTopologyCompleted
protected final java.util.concurrent.atomic.AtomicBoolean allGreenNodesChangedName
protected final java.util.concurrent.atomic.AtomicBoolean greenTopologyRecognizedLogged
protected long postStatusEndTimeNano
protected final ResourceLock processStatusLock
protected final java.util.Map<BlueGreenIntervalRate,java.lang.Long> statusCheckIntervalMap
protected final long switchoverTimeoutNano
protected final FullServicesContainer servicesContainer
protected final StorageService storageService
protected final PluginService pluginService
protected final java.util.Properties props
protected final java.lang.String bgdId
protected final java.lang.String clusterId
protected java.util.Map<java.lang.String,BlueGreenStatusProvider.PhaseTimeInfo> phaseTimeNano
protected final RdsUtils rdsUtils
protected @Nullable OpenedConnectionTracker tracker
protected final boolean dropBlueConnectionsSetting
protected boolean blueConnectionsDropped
public BlueGreenStatusProvider(@NonNull FullServicesContainer servicesContainer, @NonNull java.util.Properties props, @NonNull java.lang.String bgdId, @NonNull java.lang.String clusterId)
protected void initMonitoring()
protected java.util.Properties getMonitoringProperties()
protected void prepareStatus(@NonNull BlueGreenRole role, @NonNull BlueGreenInterimStatus interimStatus)
protected void updatePhase(BlueGreenRole role, BlueGreenInterimStatus interimStatus)
protected void updateStatusCache()
protected void updateCorrespondingNodes()
protected @Nullable HostSpec getWriterHost(BlueGreenRole role)
protected @Nullable java.util.List<HostSpec> getReaderHosts(BlueGreenRole role)
protected void updateSummaryStatus(BlueGreenRole role, BlueGreenInterimStatus interimStatus)
protected void updateMonitors()
protected void updateDnsFlags(BlueGreenRole role, BlueGreenInterimStatus interimStatus)
protected void resetMonitors(java.util.concurrent.atomic.AtomicBoolean monitorResetCompleted,
java.lang.String eventName)
protected void dropBlueConnections()
protected int getContextHash()
protected int getValueHash(int currentHash,
java.lang.String val)
protected java.lang.String getHostAndPort(java.lang.String host,
int port)
protected BlueGreenStatus getStatusOfCreated()
protected BlueGreenStatus getStatusOfPreparation()
protected java.util.List<ConnectRouting> addSubstituteBlueWithIpAddressConnectRouting()
protected BlueGreenStatus getStatusOfInProgress()
protected BlueGreenStatus getStatusOfPost()
protected void createPostRouting(java.util.List<ConnectRouting> connectRouting)
protected BlueGreenStatus getStatusOfCompleted()
protected void registerIamHost(java.lang.String connectHost,
java.lang.String iamHost)
protected boolean isAlreadySuccessfullyConnected(java.lang.String connectHost,
java.lang.String iamHost)
protected long getNanoTime()
protected void storePhaseTime(BlueGreenPhase phase)
protected void storeBlueDnsUpdateTime()
protected void storeGreenDnsRemoveTime()
protected void storeGreenNodeChangeNameTime()
protected void storeGreenTopologyChangeTime()
protected void storeMonitorResetTime(java.lang.String eventName)
protected void logSwitchoverFinalSummary()
protected void resetContextWhenCompleted()
protected void startSwitchoverTimer()
protected boolean isSwitchoverTimerExpired()
protected void checkSwitchoverTimerExpiry()
protected void logCurrentContext()
protected void logGreenTopologyRecognized()
bgdId. Readiness means both the source and
target interim statuses are available and the blue-to-green corresponding node map has been
populated. The event is logged at most once per deployment cycle (reset by
resetContextWhenCompleted()) so operators can confirm per-instance readiness before
initiating a manual switchover, without producing hot-path log spam.protected static java.util.List<java.lang.String> formatTwoColumnRows(java.util.List<java.lang.String[]> rows)
rows - the rows to format, each as a [left, right] pair.