Skip to content

Conversation

@karenc-bq
Copy link
Contributor

@karenc-bq karenc-bq commented May 3, 2023

Summary

If the initial connection is established using an cluster endpoint, use an instance endpoint when verifying connection in EFM plugin or fallback to the IP address.

Description

Integration Test Run: https://github.com/Bit-Quill/aws-advanced-jdbc-wrapper/actions/runs/4878286818

Before

2023-05-02T16:49:34.965-07:00 TRACE 55820 --- [       Thread-4] s.a.j.p.efm.MonitorConnectionContext     : Host [atlas-postgres-2.cluster-ro-....us-east-2.rds.amazonaws.com/](http://atlas-postgres-2.cluster-ro-....us-east-2.rds.amazonaws.com/) is *alive*.
2023-05-02T16:49:38.065-07:00 TRACE 55820 --- [       Thread-4] s.a.j.p.efm.MonitorConnectionContext     : Host [atlas-postgres-2.cluster-ro-....us-east-2.rds.amazonaws.com/](http://atlas-postgres-2.cluster-ro-....us-east-2.rds.amazonaws.com/) is *alive*.
2023-05-02T16:49:41.142-07:00 TRACE 55820 --- [       Thread-4] s.a.j.p.efm.MonitorConnectionContext     : Host [atlas-postgres-2.cluster-ro-....us-east-2.rds.amazonaws.com/](http://atlas-postgres-2.cluster-ro-....us-east-2.rds.amazonaws.com/) is *alive*.
2023-05-02T16:49:44.217-07:00 TRACE 55820 --- [       Thread-4] s.a.j.p.efm.MonitorConnectionContext     : Host [atlas-postgres-2.cluster-ro-....us-east-2.rds.amazonaws.com/](http://atlas-postgres-2.cluster-ro-....us-east-2.rds.amazonaws.com/) is *alive*.
2023-05-02T16:49:47.296-07:00 TRACE 55820 --- [       Thread-4] s.a.j.p.efm.MonitorConnectionContext     : Host [atlas-postgres-2.cluster-ro-....us-east-2.rds.amazonaws.com/](http://atlas-postgres-2.cluster-ro-....us-east-2.rds.amazonaws.com/) is *alive*.
2023-05-02T16:49:50.375-07:00 TRACE 55820 --- [       Thread-4] s.a.j.p.efm.MonitorConnectionContext     : Host [atlas-postgres-2.cluster-ro-....us-east-2.rds.amazonaws.com/](http://atlas-postgres-2.cluster-ro-....us-east-2.rds.amazonaws.com/) is *alive*.
2023-05-02T16:49:53.460-07:00 TRACE 55820 --- [       Thread-4] s.a.j.p.efm.MonitorConnectionContext     : Host [atlas-postgres-2.cluster-ro-....us-east-2.rds.amazonaws.com/](http://atlas-postgres-2.cluster-ro-....us-east-2.rds.amazonaws.com/) is *alive*.
2023-05-02T16:49:56.551-07:00 TRACE 55820 --- [       Thread-4] s.a.j.p.efm.MonitorConnectionContext     : Host [atlas-postgres-2.cluster-ro-....us-east-2.rds.amazonaws.com/](http://atlas-postgres-2.cluster-ro-....us-east-2.rds.amazonaws.com/) is *alive*.
2023-05-02T16:49:59.640-07:00 TRACE 55820 --- [       Thread-4] s.a.j.p.efm.MonitorConnectionContext     : Host [atlas-postgres-2.cluster-ro-....us-east-2.rds.amazonaws.com/](http://atlas-postgres-2.cluster-ro-....us-east-2.rds.amazonaws.com/) is *alive*.
2023-05-02T16:50:02.715-07:00 TRACE 55820 --- [       Thread-4] s.a.j.p.efm.MonitorConnectionContext     : Host [atlas-postgres-2.cluster-ro-....us-east-2.rds.amazonaws.com/](http://atlas-postgres-2.cluster-ro-....us-east-2.rds.amazonaws.com/) is *alive*.
2023-05-02T16:50:05.732-07:00 TRACE 55820 --- [       Thread-4] s.a.j.p.efm.MonitorConnectionContext     : Host [atlas-postgres-2.cluster-ro-....us-east-2.rds.amazonaws.com/](http://atlas-postgres-2.cluster-ro-....us-east-2.rds.amazonaws.com/) is not *responding* 1.

After

 Host mysql-instance-1.....us-east-2.rds.amazonaws.com is *alive*. 
 Host mysql-instance-1.....us-east-2.rds.amazonaws.com is *alive*. 
 Host mysql-instance-1.....us-east-2.rds.amazonaws.com is *alive*. 
 Host mysql-instance-1.....us-east-2.rds.amazonaws.com is *alive*. 
 Host mysql-instance-1.....us-east-2.rds.amazonaws.com is *alive*. 
 Host mysql-instance-1.....us-east-2.rds.amazonaws.com is *alive*. 

Additional Reviewers

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@karenc-bq karenc-bq requested review from congoamz and sergiyvamz May 3, 2023 22:49
@karenc-bq karenc-bq force-pushed the fix/efm_monitoring_endpoint branch from 92e5ac2 to 9076e43 Compare May 4, 2023 01:52
String instanceEndpoint = getInstanceEndpointPattern(host.getHost());
String instanceEndpoint = rdsHelper.getInstanceEndpointPattern(
host.getHost(),
AuroraHostListProvider.CLUSTER_INSTANCE_HOST_PATTERN.getString(this.props));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if user configuration doesn't include Aurora host list provider?

protected Set<String> aliases = ConcurrentHashMap.newKeySet();
protected Set<String> allAliases = ConcurrentHashMap.newKeySet();
protected long weight; // Greater or equal 0. Lesser the weight, the healthier node.
protected String ipAddress;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably we don't need it.

try {
final HostSpec currentHostSpec = this.pluginService.getCurrentHostSpec();
String monitoringEndpoint = null;
final RdsUrlType rdsUrlType = this.rdsHelper.identifyRdsType(monitoringEndpoint);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Qodana is right. You're passing null identifyRdsType()

if (resultSet.next()) {
instanceName = resultSet.getString(1);
}
String instanceEndpoint = rdsHelper.getInstanceEndpointPattern(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use topology to search for an instance details?

@karenc-bq
Copy link
Contributor Author

#431

@karenc-bq karenc-bq closed this May 6, 2023
@karenc-bq karenc-bq deleted the fix/efm_monitoring_endpoint branch November 15, 2023 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants