CASSANDRA-21539: Remove hostname from ClientsTable and GossipInfoTable to avoid reverse-DNS lookups - #4971
Open
nivykani wants to merge 2 commits into
Open
CASSANDRA-21539: Remove hostname from ClientsTable and GossipInfoTable to avoid reverse-DNS lookups#4971nivykani wants to merge 2 commits into
nivykani wants to merge 2 commits into
Conversation
Contributor
|
InetAddressAndPort has a toString() method that is good for splitting the difference of including a hostname along with an IP without doing a reverse lookup that could be copied for other uses Since we have the column it's a good time to figure out how we want to handle this in the future and I think it's a pick your poison sort of thing. Make it configurable with 1. Reverse DNS lookup 2. Display the hostname if it's there otherwise null column value, and 3. Always set to null. This would be a good global knob to have for all the system tables and interfaces so we can let people select the behavior they want and it can all route through one wrapper method that consults the configuration and then given an address gives you the right output. |
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.
The current code uses
getHostName(), which has the known effect:This method may trigger a name service reverse lookup if the address was created with a literal IP address.This field in both ClientsTable and GossipInfoTable was constructed with addresses to begin with, not names, sogetHostName()was always doing a blocking reverse-DNS lookup on row reads for the first call.This is a potentially slow blocking call, and we want to avoid doing any DNS lookups here because repeatedly querying this table could potentially overwhelm DNS, especially with frequently-changing client connections.
We could instead use
getHostName, but the primary key of both ClientsTable and GossipInfoTable is (address, port), where address is typeinet. Thus, this field is redundant.To the best of my searching, no in-repo consumer depends on this column having a resolved name (and instead use an address-only path), and
nodetool clientstatsalready doesn't display the hostname column.The Cassandra Jira