Emit warning when multiple peer/local entries present with the same rpc_address

Description

A common mistake someone may make when configuring cassandra is forgetting to change the default rpc_address (localhost). In such a case as this, when connecting to a multi-node cluster the driver will behave in a way that is likely not optimal for the user.

The 3.x driver will detect if the contact points peers table contains itself by logging:

It will ultimately only create 1 host.

In the 4.x driver will create a host for each entry in the peers table, leading to multiple hosts having the same endpoint address. In addition, the token map will fail to create because the driver detects duplicate entries in a map:

I think the correct behavior is to ignore duplicate entries, and to log a warning or error to the user indicating something along the lines of:

X entries in in system.peers table detected with the same rpc_address <address>, please verify your rpc_address configuration in cassandra.yaml on nodes in your cluster.

The 3.x driver behavior is the closest to how I'd expect this to work. Note that we should keep in mind that more than rpc_address may be used to determine peer uniqueness, i.e. port after .

Environment

None

Pull Requests

None

Status

Assignee

Alexandre Dutra

Reporter

Andy Tolbert

Labels

None

PM Priority

None

Affects versions

Fix versions

Pull Request

None

Doc Impact

None

Size

None

External issue ID

None

External issue ID

None

Priority

Minor
Configure