beobal commented on code in PR #3263:
URL: https://github.com/apache/cassandra/pull/3263#discussion_r1571149003
##########
src/java/org/apache/cassandra/db/virtual/PeersTable.java:
##########
@@ -156,9 +156,7 @@ public static void updateLegacyPeerTable(NodeId nodeId,
ClusterMetadata prev, Cl
if (next.directory.peerState(nodeId) == null ||
next.directory.peerState(nodeId) == NodeState.LEFT)
{
NodeAddresses addresses = prev.directory.getNodeAddresses(nodeId);
- logger.debug("Purging {} from system.peers_v2 table", addresses);
- QueryProcessor.executeInternal(String.format(peers_delete_query,
SYSTEM_KEYSPACE_NAME, PEERS_V2), addresses.broadcastAddress.getAddress(),
addresses.broadcastAddress.getPort());
-
QueryProcessor.executeInternal(String.format(legacy_peers_delete_query,
SYSTEM_KEYSPACE_NAME, LEGACY_PEERS), addresses.broadcastAddress.getAddress());
+ removeFromLegacyPeerTable(addresses.broadcastAddress);
Review Comment:
can also replace the calls on lines 171-173 below
##########
src/java/org/apache/cassandra/db/virtual/PeersTable.java:
##########
@@ -197,4 +195,11 @@ else if
(NodeState.isPreJoin(next.directory.peerState(nodeId)))
tokens);
}
}
+
+ public static void removeFromLegacyPeerTable(InetAddressAndPort addr)
Review Comment:
nit: IMO this name is slightly confusing because we execute not only
`legacy_peers_delete_query` but also `peers_delete_query`. I know that *both*
those tables are "legacy" in the sense that `ClusterMetadata.directory` is the
primary datasource now, but I'd either rename the method to
`removeFromSystemPeersTables` or rename the queries to `peers_delete_query /
peers_v2_delete_query`
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]