@Override public void setMasterServices(MasterServices masterServices) { masterServerName = masterServices.getServerName(); this.services = masterServices; if (useRegionFinder) { this.regionFinder.setServices(masterServices); } if (this.services.isInMaintenanceMode()) { this.maintenanceMode = true; } }
@Override protected void chore() { try { AssignmentManager am = this.services.getAssignmentManager(); if (this.enabled.get() && !this.services.isInMaintenanceMode() && !this.services.getServerManager().isClusterShutdown() && am != null && am.isMetaLoaded() && !am.hasRegionsInTransition()) { scan(); } else { LOG.warn("CatalogJanitor is disabled! Enabled=" + this.enabled.get() + ", maintenanceMode=" + this.services.isInMaintenanceMode() + ", am=" + am + ", metaLoaded=" + (am != null && am.isMetaLoaded()) + ", hasRIT=" + (am != null && am.hasRegionsInTransition()) + " clusterShutDown=" + this.services .getServerManager().isClusterShutdown()); } } catch (IOException e) { LOG.warn("Failed scan of catalog table", e); } }
/** * Calculate min necessary to start. This is not an absolute. It is just * a friction that will cause us hang around a bit longer waiting on * RegionServers to check-in. */ private int getMinToStart() { if (master.isInMaintenanceMode()) { // If in maintenance mode, then master hosting meta will be the only server available return 1; } int minimumRequired = 1; if (LoadBalancer.isTablesOnMaster(master.getConfiguration()) && LoadBalancer.isSystemTablesOnlyOnMaster(master.getConfiguration())) { // If Master is carrying regions it will show up as a 'server', but is not handling user- // space regions, so we need a second server. minimumRequired = 2; } int minToStart = this.master.getConfiguration().getInt(WAIT_ON_REGIONSERVERS_MINTOSTART, -1); // Ensure we are never less than minimumRequired else stuff won't work. return Math.max(minToStart, minimumRequired); }
if (this.services.isInMaintenanceMode()) { if (this.services.isInMaintenanceMode()) {