Prevent warning log when using Execution profile that specifies a different local DC
Description
Environment
Pull Requests
Activity

Olivier Michallat March 4, 2020 at 5:50 PM
The issue is related to the use of profiles:
In that case, profile1
gets its own LBP instance, which will log the warning if contact points are from dc1.
I think at the very least we should not log the warning when the policy belongs to a profile (which you can tell by the profileName
constructor parameter).
It could also be argued that having contact points in both datacenters is legitimate with the setup above. So maybe we should go one step further and allow the local DCs of all existing profiles.

Greg Bestland February 12, 2020 at 9:18 PM
So upon investigation I think this is working as expected. Here is why.
The error actually emanates from the construction of the loadbalancing policy upon cluster creation.
The error can only occur when a multi-dc contact list is used, or endpoints from multi-dc’s are programmatically added, or when the DC specified in the configuration that is not the dc of the contact points.
The error is only going to occur when our default LBP is used. That is explicitly only supposed to be used with a local dc as explained in our documentation here.https://github.com/datastax/java-driver/tree/4.x/manual/core/load_balancing#local-only
I think based on my testing and the context that this is error is appropriate. If someone was interested in a multi-dc approach they would need author their own LBP, which of course would by-pass this check entirely.
Details
Details
Assignee

Reporter

In a multi-datacenter cluster, if the driver configures an execution profile that overrides the local-datacenter, a warning log is generated when queries are executed using that profile.
This is because
OptionalLocalDcHelper.checkLocalDatacenterCompatibility
does not consider the execution profile associated with the load balancing policy for which the helper was created, and throws the warning when the specified contact-points are not part of the datacenter specified in the profile.The queries are still executed successfully, but the warning leads users to believe there is something mis-configured when there isn't.