smiklosovic commented on code in PR #4547:
URL: https://github.com/apache/cassandra/pull/4547#discussion_r2687697320
##########
src/java/org/apache/cassandra/service/disk/usage/DiskUsageBroadcaster.java:
##########
@@ -131,6 +206,80 @@ private boolean computeHasStuffedOrFullNode()
return false;
}
+ /**
+ * Update the set of full nodes by datacenter based on the disk usage
state for the given endpoint.
+ * If the node is FULL, add it to the set for its datacenter. Otherwise,
remove it from the set.
+ * This method is idempotent - adding an already-present node or removing
an absent node has no effect.
+ *
+ * @param endpoint The endpoint whose state has changed.
+ * @param usageState The new disk usage state value.
+ */
+ private void computeUsageStateForEpDatacenter(InetAddressAndPort endpoint,
DiskUsageState usageState)
+ {
+ Locator locator = DatabaseDescriptor.getLocator();
+ if (locator == null)
+ {
+ logger.debug("Unable to track disk usage by datacenter for
endpoint {} because locator is null", endpoint);
+ return;
+ }
+
+ Location location = locator.location(endpoint);
+ if (location == null || location.equals(Location.UNKNOWN))
+ {
+ logger.debug("Unable to track disk usage by datacenter for
endpoint {} because null or UNKNOWN location was returned",
+ endpoint);
+ return;
+ }
+
+ String datacenter = location.datacenter;
+
+ if (usageState.isFull())
+ {
+ // Add this node to the set of full nodes for its datacenter and
remove if from the stuffed nodes
Review Comment:
... and remove it from ...
--
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]