aalhour commented on code in PR #5681: URL: https://github.com/apache/hbase/pull/5681#discussion_r1495683944
########## hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java: ########## @@ -293,6 +330,36 @@ public void regionServerReport(ServerName sn, ServerMetrics sl) throws YouAreDea updateLastFlushedSequenceIds(sn, sl); } + /** + * Checks if the Master is configured to reject decommissioned hosts or not. When it's configured + * to do so, any RegionServer trying to join the cluster will have it's host checked against the + * list of hosts of currently decommissioned servers and potentially get prevented from reporting + * for duty; otherwise, we do nothing and we let them pass to the next check. See HBASE-28342 for + * details. + * @param sn The ServerName to check for + * @throws HostIsConsideredDecommissionedException if the Master is configured to reject + * decommissioned hosts and this host exists in + * the list of the decommissioned servers + */ + private void checkRejectableDecommissionedStatus(ServerName sn) + throws HostIsConsideredDecommissionedException { + // If the Master is not configured to reject decommissioned hosts, return early. + if (!rejectDecommissionedHostsConfig) { + return; + } + + // Look for a match for the hostname in the list of decommissioned servers + for (ServerName server : getDrainingServersList()) { + if (Objects.equals(server.getHostname(), sn.getHostname())) { + // Found a match and master is configured to reject decommissioned hosts, throw exception! + LOG.warn("Rejecting RegionServer {} from reporting for duty because Master is configured " + + "to reject decommissioned hosts and this host was marked as such in the past.", sn); + throw new HostIsConsideredDecommissionedException( + "Master is configured to reject decommissioned hosts"); Review Comment: I'll re-write that exception message and include the hostname. However, I'm not sure about including it as a field in the Exception class since it get's handled as an IOException in the `HRegionServer.reportForDuty()` instance method. The exception gets printed as is. -- 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: issues-unsubscr...@hbase.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org