You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2020/10/13 10:55:55 UTC

[GitHub] [cassandra] adelapena commented on a change in pull request #599: CASSANDRA-14361 Allow SimpleSeedProvider to resolve multiple IPs per DNS name

adelapena commented on a change in pull request #599:
URL: https://github.com/apache/cassandra/pull/599#discussion_r503853602



##########
File path: src/java/org/apache/cassandra/locator/InetAddressAndPort.java
##########
@@ -24,12 +24,17 @@
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.nio.ByteBuffer;
+import java.util.Collection;

Review comment:
       Nit: this import is not used

##########
File path: src/java/org/apache/cassandra/locator/InetAddressAndPort.java
##########
@@ -24,12 +24,17 @@
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.nio.ByteBuffer;
+import java.util.Collection;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 import java.util.Objects;
 import java.util.regex.Pattern;
 
 import com.google.common.base.Preconditions;
 import com.google.common.net.HostAndPort;
 
+import org.apache.cassandra.config.DatabaseDescriptor;

Review comment:
       Nit: this import is not used

##########
File path: src/java/org/apache/cassandra/locator/SimpleSeedProvider.java
##########
@@ -53,15 +55,30 @@ public SimpleSeedProvider(Map<String, String> args) {}
             try
             {
                 if(!host.trim().isEmpty()) {
-                    seeds.add(InetAddressAndPort.getByName(host.trim()));
+                    if (DatabaseDescriptor.useMultiIPsPerDNSRecord()) {
+                        List<InetAddressAndPort> resolvedSeeds = InetAddressAndPort.getAllByName(host.trim());
+                        seeds.addAll(resolvedSeeds);
+                        logger.debug("{} resolves to {}", host, resolvedSeeds);
+
+                    } else {
+                        InetAddressAndPort addressAndPort = InetAddressAndPort.getByName(host.trim());
+                        seeds.add(addressAndPort);
+                        logger.debug("Only resolving one IP per DNS record - {} resolves to {}", host, addressAndPort);
+                    }
                 }
+
             }
             catch (UnknownHostException ex)
             {
                 // not fatal... DD will bark if there end up being zero seeds.
                 logger.warn("Seed provider couldn't lookup host {}", host);
             }
         }
+
+

Review comment:
       Nit: double blank line
   ```suggestion
   
   ```

##########
File path: src/java/org/apache/cassandra/locator/SimpleSeedProvider.java
##########
@@ -53,15 +55,30 @@ public SimpleSeedProvider(Map<String, String> args) {}
             try
             {
                 if(!host.trim().isEmpty()) {
-                    seeds.add(InetAddressAndPort.getByName(host.trim()));
+                    if (DatabaseDescriptor.useMultiIPsPerDNSRecord()) {

Review comment:
       Nit: According to [the project's code style](https://cassandra.apache.org/doc/latest/development/code_style.html):
   ```suggestion
                       if (DatabaseDescriptor.useMultiIPsPerDNSRecord())
                       {
   ```

##########
File path: src/java/org/apache/cassandra/locator/SimpleSeedProvider.java
##########
@@ -53,15 +55,30 @@ public SimpleSeedProvider(Map<String, String> args) {}
             try
             {
                 if(!host.trim().isEmpty()) {
-                    seeds.add(InetAddressAndPort.getByName(host.trim()));
+                    if (DatabaseDescriptor.useMultiIPsPerDNSRecord()) {
+                        List<InetAddressAndPort> resolvedSeeds = InetAddressAndPort.getAllByName(host.trim());
+                        seeds.addAll(resolvedSeeds);
+                        logger.debug("{} resolves to {}", host, resolvedSeeds);
+
+                    } else {

Review comment:
       ```suggestion
                       }
                       else
                       {
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org