Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only insert hostnames if not present for internal broadcast addrs #455

Merged
merged 4 commits into from
Nov 22, 2023

Conversation

zpear
Copy link
Contributor

@zpear zpear commented Nov 20, 2023

We discovered that two hostnames in a separate VPC can resolve to the same proxy IP and we were mistakenly swapping them, since we were tracking proxy/public IPs as well as private/broadcast addresses.

This PR rips out some direct IP-mapping logic, as it was quite convoluted, and focuses on hostname-related mapping only.

We now only track internal IP / broadcast address -> hostname, and will only update the endpoint we are trying to hit if the InetAddress does not contain a hostname, or has a hostname + endpoint which is from the other VPC (and therefore in our map).

If there is a hostname + we do not have the IP in the map, it must be a "public" / proxy IP, so we should leave the InetAddress as-is.

example:

For a node in another VPC hostA with broadcast address 10.100.0.1 that resolves to 10.9.0.1, 10.9.0.2, and 10.9.0.3 in the other VPC, you could have the following:

  • hostA/10.100.0.1 -> (DNS) hostA/10.9.0.(1,2,3)
  • hostA/10.9.0.(1,2,3) -> no-op
  • /10.100.0.1 -> look up in our map -> hostA/10.9.0.(1,2,3)

@zpear zpear marked this pull request as ready for review November 20, 2023 22:45
@@ -1398,6 +1398,7 @@ public static void setCrossVpcInternodeCommunication(boolean setting)
conf.cross_vpc_internode_communication_enabled = setting;
}

@Deprecated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's file a github issue to remove this entirely at some point?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done #456

if (DatabaseDescriptor.isCrossVpcIpSwappingEnabled() && privatePublicIpMappings.containsKey(proposedAddress)) {
return maybeSwapIp(endpoint);
if (DatabaseDescriptor.isCrossVpcHostnameSwappingEnabled() && privateIpToHostname.containsKey(proposedAddress)) {
return maybeInsertHostname(endpoint);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: { should be on the next line

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing on a couple other places in this class

@zpear zpear merged commit 80068a8 into palantir-cassandra-2.2.18 Nov 22, 2023
@zpear zpear deleted the zp/simplify-cross-vpc-mapping branch November 22, 2023 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants