Skip to content

Commit eb4b576

Browse files
author
alexsa
committed
Nits and docs improvements
1 parent 05f38bf commit eb4b576

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

core/src/main/java/com/datastax/oss/driver/internal/core/addresstranslation/SubnetAddressTranslator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ private static IPAddress parseSubnet(String subnetCIDR) {
192192
throw new IllegalArgumentException("Invalid subnet: " + subnetCIDR);
193193
}
194194
if (!subnet.isPrefixBlock()) {
195-
196195
throw new IllegalArgumentException(
197196
String.format(
198197
"Subnet %s must be represented as a network prefix block %s",

core/src/main/resources/reference.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,7 @@ datastax-java-driver {
10281028
# The driver provides the following implementations out of the box:
10291029
# - PassThroughAddressTranslator: returns all addresses unchanged.
10301030
# - FixedHostNameAddressTranslator: translates all addresses to a specific hostname.
1031-
# - SubnetAddressTranslator: translates addresses to hostname based on the subnet matches.
1031+
# - SubnetAddressTranslator: translates addresses to hostname based on the subnet match.
10321032
# - Ec2MultiRegionAddressTranslator: suitable for an Amazon multi-region EC2 deployment where
10331033
# clients are also deployed in EC2. It optimizes network costs by favoring private IPs over
10341034
# public ones whenever possible.
@@ -1048,7 +1048,7 @@ datastax-java-driver {
10481048
# # "::ffff:6440:0/111" = "cassandra.datacenter1.com:9042"
10491049
# # "::ffff:6442:0/111" = "cassandra.datacenter2.com:9042"
10501050
# }
1051-
# Optional. When configured, addresses not matching the configured subnets are translated this address.
1051+
# Optional. When configured, addresses not matching the configured subnets are translated to this address.
10521052
# default-address = "cassandra.datacenter1.com:9042"
10531053
# Note: `advanced.resolve-contact-points` (see below) is used to determine whether to resolve subnet
10541054
# and default address on translation.

manual/core/address_resolution/README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ proxy, we have an option to use `FixedHostNameAddressTranslator`. But for multi-
139139
want to have more control over routing queries to a specific datacenter (eg. for optimizing latencies), which requires
140140
setting up a separate proxy per datacenter.
141141

142-
Normally, each Cassandra datacenter nodes are deployed to a separate subnet to support internode communications in the
143-
cluster and avoid IP addresses collisions. So when Cassandra broadcasts its nodes IP addresses, we can determine which
142+
Normally, each Cassandra datacenter nodes are deployed to a different subnet to support internode communications in the
143+
cluster and avoid IP address collisions. So when Cassandra broadcasts its nodes IP addresses, we can determine which
144144
datacenter that node belongs to by checking its IP address against the given datacenter subnet.
145145

146146
For such scenarios you can use `SubnetAddressTranslator` to translate node IPs to the datacenter proxy address
@@ -152,13 +152,15 @@ datastax-java-driver.advanced.address-translator {
152152
class = SubnetAddressTranslator
153153
subnet-addresses {
154154
"100.64.0.0/15" = "cassandra.datacenter1.com:9042"
155-
"100.66.0.0/15" = "cassandra.datacenter2.com" # port defaults to 9042 if not specified
155+
"100.66.0.0/15" = "cassandra.datacenter2.com:9042"
156156
# IPv6 example:
157157
# "::ffff:6440:0/111" = "cassandra.datacenter1.com:9042"
158-
# "::ffff:6442:0/111" = "cassandra.datacenter2.com" # port defaults to 9042 if not specified
158+
# "::ffff:6442:0/111" = "cassandra.datacenter2.com:9042"
159159
}
160-
# Optional. When configured, addresses not matching the configured subnets are translated to it. Port defaults to 9042 if not specified.
160+
# Optional. When configured, addresses not matching the configured subnets are translated to this address.
161161
default-address = "cassandra.datacenter1.com:9042"
162+
# Note: `advanced.resolve-contact-points` is used to determine whether to resolve subnet and default address
163+
# on translation.
162164
}
163165
```
164166

0 commit comments

Comments
 (0)