Prevent warning log when using Execution profile that specifies a different local DC

Description

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.

You specified dc2 as the local DC, but some contact points are from a different DC

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.

Environment

None

Pull Requests

None

Activity

Show:

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.

  1. The error actually emanates from the construction of the loadbalancing policy upon cluster creation.

  2. 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.

  3. 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

Assignee

Reporter

Labels

Components

Sprint

Priority

Created January 29, 2020 at 5:27 AM
Updated January 25, 2022 at 4:58 AM