Repository navigation
chore: align contact point parsing and validation with DataStax driver - #434
Closed
sakthivelmanii wants to merge 1 commit into
Closed
sakthivelmanii wants to merge 1 commit into
sakthivelmanii wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Following #423,
SpannerCqlSessionBuilder.checkContactPoints()diverged fromSessionBuilder(java-driver-core) in five loopback contact-point edge cases:localhost:<port>inDriverConfigLoader/application.conf(resolving to both127.0.0.1and::1) was rejected due toresolvedAddresses.length != 1.InetSocketAddressvalues (e.g.,InetSocketAddress.createUnresolved("localhost", 9042)) were rejected becausegetAddress()isnull.addContactPoint(...)was rejected before deduplication."::1:9042") inDriverConfigLoaderwere rejected by Guava'sHostAndPort.fromString(...), whereas the DataStax driver accepts both::1:9042and[::1]:9042.defaultConfigLoader()ignored custom class loaders configured viawithClassLoader(ClassLoader).Solution
InetAddress.getAllByName(host)are loopback and bind the embedded adapter toresolvedAddresses[0](continuing to reject any mixed loopback/non-loopback resolution).InetSocketAddressinstances viaInetAddress.getAllByName(getHostString())and verify all resolved addresses are loopback.InetSocketAddressentries in aSetbefore enforcing the single-contact-point limit.host:portstrings usinglastIndexOf(':')with optional[...]IPv6 bracket stripping, matching the DataStax driver's parser while requiring a port in1..65535.defaultConfigLoader(programmaticArgumentsBuilder.build().getClassLoader())so custom class loaders are honored when readingapplication.conf.SpannerCqlSessionBuilderTestcovering all five cases.