sershe-ms commented on a change in pull request #237: HBASE-22408 add dead and
unknown server open regions metric to AM 01
URL: https://github.com/apache/hbase/pull/237#discussion_r284483908
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java
##########
@@ -1130,6 +1148,65 @@ protected void periodicExecute(final MasterProcedureEnv
env) {
}
}
+ private static class NonLiveServerMetricRegionChore extends
ProcedureInMemoryChore<MasterProcedureEnv> {
+ public NonLiveServerMetricRegionChore(final int timeoutMsec) {
+ super(timeoutMsec);
+ }
+
+ @Override
+ protected void periodicExecute(final MasterProcedureEnv env) {
+ final ServerManager sm = env.getMasterServices().getServerManager();
+ final AssignmentManager am = env.getAssignmentManager();
+ // To minimize inconsistencies we are not going to snapshot live servers
in advance in case
+ // new servers are added; OTOH we don't want to add heavy sync for a
consistent view since
+ // this is for metrics. Instead, we're going to check each regions as we
go; to avoid making
+ // too many checks, we maintain a local lists of server, limiting us to
false negatives. If
+ // we miss some recently-dead server, we'll just see it next time.
+ Set<ServerName> recentlyLiveServers = new HashSet<>();
+ int deadRegions = 0, unknownRegions = 0;
+ for (RegionStateNode rsn : am.getRegionStates().getRegionStateNodes()) {
+ if (rsn.getState() != State.OPEN) {
+ continue; // Opportunistic check, should quickly skip RITs, offline
tables, etc.
+ }
+ ServerName sn;
+ State state;
+ synchronized (rsn.getState()) {
Review comment:
thanks, this is incorrect. It was actually going to sync on rsn, but it
should be locking the lock.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services