Change default port if provided in new cluster #1645
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.
Currently, when creating a cluster, the contact points can contain the port as well. Currently this does not change the port when a new cluster is configured, causing timeout issues to peers. This especially impacting when using TLS which is using 9142 instead of 9042. If user does not set Cluster.Port connection to peers will fail. Traditionally, cassandra drivers do not support connecting to nodes on different cql ports. All nodes must have the same cql port. The result is users may end up connected only to provided seeds initial host without connecting to peers. This pull request adds port assignment to NewCluster by extracting it from the host string if provided
Previously when using the following connection, initial control connection will connect to provided host with 9142. Discovered peers will connect to 9042 the default.
User must add the port after to fix.
This change will allow user to create connection string and the default host will be the one provided if found. Eliminating simple mistake.