Skip to content

Commit 4fa5c71

Browse files
bsubhashnidaschl
authored andcommitted
JCBC-1207: Dont do reverse address lookup for DNS SRV bootstrap
Motivation ---------- Changes for JVMCBC-513 made sure the addresses can be resolved to fix unhandled NPE. This check is not necessary for DNS SRV bootstrap. Changes ------- Use the unresolved hosts from ConnectionString in core. Changed the bad ips to x.y.z on the tests as they resolve now. Change-Id: I0821c247923144c103416d0a43d8ddf6ec2c9b73 Reviewed-on: http://review.couchbase.org/95228 Reviewed-by: Michael Nitschinger <[email protected]> Tested-by: Michael Nitschinger <[email protected]>
1 parent ca15876 commit 4fa5c71

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/integration/java/com/couchbase/client/java/ConnectionTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,14 @@ public void shouldBootstrapWithBadHost() {
8383

8484
@Test
8585
public void shouldProvideClusterInfoWithBadHostInBootstrapList() {
86-
Cluster cluster = CouchbaseCluster.create("1.1.1.1", "2.2.2.2", "3.3.3.3", "4.4.4.4", TestProperties.seedNode());
86+
Cluster cluster = CouchbaseCluster.create("x.y.z", TestProperties.seedNode());
87+
cluster.authenticate(TestProperties.adminName(), TestProperties.adminPassword());
88+
cluster.clusterManager().info();
89+
}
90+
91+
@Test(expected = NullPointerException.class)
92+
public void shouldNotCheckReverseLookupWhenDNSSRVEnabled() throws Exception {
93+
Cluster cluster = CouchbaseCluster.create(DefaultCouchbaseEnvironment.builder().dnsSrvEnabled(true).build(), "x.y.z");
8794
cluster.authenticate(TestProperties.adminName(), TestProperties.adminPassword());
8895
cluster.clusterManager().info();
8996
}

src/main/java/com/couchbase/client/java/CouchbaseAsyncCluster.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,11 +325,11 @@ private static List<String> assembleSeedNodes(ConnectionString connectionString,
325325
*/
326326
private static void seedNodesViaDnsSrv(ConnectionString connectionString,
327327
CouchbaseEnvironment environment, List<String> seedNodes) {
328-
if (connectionString.hosts().size() == 1) {
329-
InetSocketAddress lookupNode = connectionString.hosts().get(0);
328+
if (connectionString.allHosts().size() == 1) {
329+
InetSocketAddress lookupNode = connectionString.allHosts().get(0);
330330
LOGGER.debug(
331331
"Attempting to load DNS SRV records from {}.",
332-
connectionString.hosts().get(0)
332+
connectionString.allHosts().get(0)
333333
);
334334

335335
try {

0 commit comments

Comments
 (0)