Filter deleted Aurora replicas from auto-discovery #2336
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Aurora instances that have been deleted still exist in the
INFORMATION_SCHEMA.REPLICA_HOST_STATUS
table, but with aREPLICA_LAG_IN_MILLISECONDS
set to900000
. This causes the current autodiscovery query to continue to add entries toruntime_mysql_servers
for deleted instances, adding unnecessary connection-failure errors to the log as it continues to try to connect to an instance that no longer exists.To allow auto discovery to remove these deleted instances from the server list, this PR adds
AND REPLICA_LAG_IN_MILLISECONDS != 900000
to the monitor query, which removes it from the query results.I haven't tested this code change through the existing Aurora automated testing, but I have manually run the new query on an existing Aurora cluster (version
5.7.mysql_aurora.2.04.6
) with a deleted replica instance to verify the correct results:Old query:
New query: