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.
If using a DNS address to establish a connection to a cassandra cluster, it is possible to get a mismatch in
connect_address
andbroadcast_address
for a singleHostInfo
type if using the defaultHostDialer
. This can occur in the following code path:At step five the
HostInfo
struct has the following form:But when attempting to connect the cassandra cluster with the DNS address, it can connect to any node in the cluster that the address resolves to. This eventually can result in the following:
This
HostInfo
hasconnectAddress="10.128.189.205
andbroadcast_address="10.128.89.255"
where both IP addresses are nodes in the cassandra cluster. Thehost_id
of theHostInfo
is for that of the node whose IP is equal to the broadcast_address. The result of this is that although the Connection is supposed to be established to the node whose IP address is equal to thebroadcast_address
it is actually connected to the node whose IP is theconnect_address
. Additionally, thering
will now have duplicate hosts:I believe this was effected by the following change: #1632. Nodes were previously added/removed by their
connect_address
(contrary to the PR title), so, using the previous example, if10.128.189.205
went down, bothHosts
were removed from theRing
. Now, when10.128.189.205
goes down, only the host whosebroadcast_address
will be removed. So by product of replacing nodes in the cluster, it is possible to end up in a state where a number of clients are attempting to connect to outdated IP addresses that are no longer part of the cluster and that the DNS address no longer resolves to either