hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From git-site-r...@apache.org
Subject [20/29] hbase-site git commit: Published site at 477f9fdb32873387231c5fbbff130ba8bf7b5d68.
Date Fri, 25 May 2018 14:48:24 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/621479e1/devapidocs/src-html/org/apache/hadoop/hbase/master/HMaster.InitializationMonitor.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/master/HMaster.InitializationMonitor.html b/devapidocs/src-html/org/apache/hadoop/hbase/master/HMaster.InitializationMonitor.html
index 2b1b6c6..adaa381 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/master/HMaster.InitializationMonitor.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/master/HMaster.InitializationMonitor.html
@@ -1011,2651 +1011,2662 @@
 <span class="sourceLineNo">1003</span>    }<a name="line.1003"></a>
 <span class="sourceLineNo">1004</span><a name="line.1004"></a>
 <span class="sourceLineNo">1005</span>    zombieDetector.interrupt();<a name="line.1005"></a>
-<span class="sourceLineNo">1006</span>  }<a name="line.1006"></a>
-<span class="sourceLineNo">1007</span><a name="line.1007"></a>
-<span class="sourceLineNo">1008</span>  /**<a name="line.1008"></a>
-<span class="sourceLineNo">1009</span>   * Adds the {@code MasterSpaceQuotaObserver} to the list of configured Master observers to<a name="line.1009"></a>
-<span class="sourceLineNo">1010</span>   * automatically remove space quotas for a table when that table is deleted.<a name="line.1010"></a>
-<span class="sourceLineNo">1011</span>   */<a name="line.1011"></a>
-<span class="sourceLineNo">1012</span>  @VisibleForTesting<a name="line.1012"></a>
-<span class="sourceLineNo">1013</span>  public void updateConfigurationForSpaceQuotaObserver(Configuration conf) {<a name="line.1013"></a>
-<span class="sourceLineNo">1014</span>    // We're configured to not delete quotas on table deletion, so we don't need to add the obs.<a name="line.1014"></a>
-<span class="sourceLineNo">1015</span>    if (!conf.getBoolean(<a name="line.1015"></a>
-<span class="sourceLineNo">1016</span>          MasterSpaceQuotaObserver.REMOVE_QUOTA_ON_TABLE_DELETE,<a name="line.1016"></a>
-<span class="sourceLineNo">1017</span>          MasterSpaceQuotaObserver.REMOVE_QUOTA_ON_TABLE_DELETE_DEFAULT)) {<a name="line.1017"></a>
-<span class="sourceLineNo">1018</span>      return;<a name="line.1018"></a>
-<span class="sourceLineNo">1019</span>    }<a name="line.1019"></a>
-<span class="sourceLineNo">1020</span>    String[] masterCoprocs = conf.getStrings(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY);<a name="line.1020"></a>
-<span class="sourceLineNo">1021</span>    final int length = null == masterCoprocs ? 0 : masterCoprocs.length;<a name="line.1021"></a>
-<span class="sourceLineNo">1022</span>    String[] updatedCoprocs = new String[length + 1];<a name="line.1022"></a>
-<span class="sourceLineNo">1023</span>    if (length &gt; 0) {<a name="line.1023"></a>
-<span class="sourceLineNo">1024</span>      System.arraycopy(masterCoprocs, 0, updatedCoprocs, 0, masterCoprocs.length);<a name="line.1024"></a>
-<span class="sourceLineNo">1025</span>    }<a name="line.1025"></a>
-<span class="sourceLineNo">1026</span>    updatedCoprocs[length] = MasterSpaceQuotaObserver.class.getName();<a name="line.1026"></a>
-<span class="sourceLineNo">1027</span>    conf.setStrings(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY, updatedCoprocs);<a name="line.1027"></a>
-<span class="sourceLineNo">1028</span>  }<a name="line.1028"></a>
-<span class="sourceLineNo">1029</span><a name="line.1029"></a>
-<span class="sourceLineNo">1030</span>  private void initMobCleaner() {<a name="line.1030"></a>
-<span class="sourceLineNo">1031</span>    this.expiredMobFileCleanerChore = new ExpiredMobFileCleanerChore(this);<a name="line.1031"></a>
-<span class="sourceLineNo">1032</span>    getChoreService().scheduleChore(expiredMobFileCleanerChore);<a name="line.1032"></a>
-<span class="sourceLineNo">1033</span><a name="line.1033"></a>
-<span class="sourceLineNo">1034</span>    int mobCompactionPeriod = conf.getInt(MobConstants.MOB_COMPACTION_CHORE_PERIOD,<a name="line.1034"></a>
-<span class="sourceLineNo">1035</span>        MobConstants.DEFAULT_MOB_COMPACTION_CHORE_PERIOD);<a name="line.1035"></a>
-<span class="sourceLineNo">1036</span>    if (mobCompactionPeriod &gt; 0) {<a name="line.1036"></a>
-<span class="sourceLineNo">1037</span>      this.mobCompactChore = new MobCompactionChore(this, mobCompactionPeriod);<a name="line.1037"></a>
-<span class="sourceLineNo">1038</span>      getChoreService().scheduleChore(mobCompactChore);<a name="line.1038"></a>
-<span class="sourceLineNo">1039</span>    } else {<a name="line.1039"></a>
-<span class="sourceLineNo">1040</span>      LOG<a name="line.1040"></a>
-<span class="sourceLineNo">1041</span>        .info("The period is " + mobCompactionPeriod + " seconds, MobCompactionChore is disabled");<a name="line.1041"></a>
-<span class="sourceLineNo">1042</span>    }<a name="line.1042"></a>
-<span class="sourceLineNo">1043</span>    this.mobCompactThread = new MasterMobCompactionThread(this);<a name="line.1043"></a>
-<span class="sourceLineNo">1044</span>  }<a name="line.1044"></a>
-<span class="sourceLineNo">1045</span><a name="line.1045"></a>
-<span class="sourceLineNo">1046</span>  /**<a name="line.1046"></a>
-<span class="sourceLineNo">1047</span>   * Create a {@link MasterMetaBootstrap} instance.<a name="line.1047"></a>
-<span class="sourceLineNo">1048</span>   */<a name="line.1048"></a>
-<span class="sourceLineNo">1049</span>  MasterMetaBootstrap createMetaBootstrap(final HMaster master, final MonitoredTask status) {<a name="line.1049"></a>
-<span class="sourceLineNo">1050</span>    // We put this out here in a method so can do a Mockito.spy and stub it out<a name="line.1050"></a>
-<span class="sourceLineNo">1051</span>    // w/ a mocked up MasterMetaBootstrap.<a name="line.1051"></a>
-<span class="sourceLineNo">1052</span>    return new MasterMetaBootstrap(master, status);<a name="line.1052"></a>
-<span class="sourceLineNo">1053</span>  }<a name="line.1053"></a>
-<span class="sourceLineNo">1054</span><a name="line.1054"></a>
-<span class="sourceLineNo">1055</span>  /**<a name="line.1055"></a>
-<span class="sourceLineNo">1056</span>   * Create a {@link ServerManager} instance.<a name="line.1056"></a>
-<span class="sourceLineNo">1057</span>   */<a name="line.1057"></a>
-<span class="sourceLineNo">1058</span>  ServerManager createServerManager(final MasterServices master) throws IOException {<a name="line.1058"></a>
-<span class="sourceLineNo">1059</span>    // We put this out here in a method so can do a Mockito.spy and stub it out<a name="line.1059"></a>
-<span class="sourceLineNo">1060</span>    // w/ a mocked up ServerManager.<a name="line.1060"></a>
-<span class="sourceLineNo">1061</span>    setupClusterConnection();<a name="line.1061"></a>
-<span class="sourceLineNo">1062</span>    return new ServerManager(master);<a name="line.1062"></a>
-<span class="sourceLineNo">1063</span>  }<a name="line.1063"></a>
-<span class="sourceLineNo">1064</span><a name="line.1064"></a>
-<span class="sourceLineNo">1065</span>  private void waitForRegionServers(final MonitoredTask status)<a name="line.1065"></a>
-<span class="sourceLineNo">1066</span>      throws IOException, InterruptedException {<a name="line.1066"></a>
-<span class="sourceLineNo">1067</span>    this.serverManager.waitForRegionServers(status);<a name="line.1067"></a>
-<span class="sourceLineNo">1068</span>    // Check zk for region servers that are up but didn't register<a name="line.1068"></a>
-<span class="sourceLineNo">1069</span>    for (ServerName sn: this.regionServerTracker.getOnlineServers()) {<a name="line.1069"></a>
-<span class="sourceLineNo">1070</span>      // The isServerOnline check is opportunistic, correctness is handled inside<a name="line.1070"></a>
-<span class="sourceLineNo">1071</span>      if (!this.serverManager.isServerOnline(sn) &amp;&amp;<a name="line.1071"></a>
-<span class="sourceLineNo">1072</span>          serverManager.checkAndRecordNewServer(sn, ServerMetricsBuilder.of(sn))) {<a name="line.1072"></a>
-<span class="sourceLineNo">1073</span>        LOG.info("Registered server found up in zk but who has not yet reported in: " + sn);<a name="line.1073"></a>
-<span class="sourceLineNo">1074</span>      }<a name="line.1074"></a>
-<span class="sourceLineNo">1075</span>    }<a name="line.1075"></a>
-<span class="sourceLineNo">1076</span>  }<a name="line.1076"></a>
-<span class="sourceLineNo">1077</span><a name="line.1077"></a>
-<span class="sourceLineNo">1078</span>  void initClusterSchemaService() throws IOException, InterruptedException {<a name="line.1078"></a>
-<span class="sourceLineNo">1079</span>    this.clusterSchemaService = new ClusterSchemaServiceImpl(this);<a name="line.1079"></a>
-<span class="sourceLineNo">1080</span>    this.clusterSchemaService.startAsync();<a name="line.1080"></a>
-<span class="sourceLineNo">1081</span>    try {<a name="line.1081"></a>
-<span class="sourceLineNo">1082</span>      this.clusterSchemaService.awaitRunning(getConfiguration().getInt(<a name="line.1082"></a>
-<span class="sourceLineNo">1083</span>        HBASE_MASTER_WAIT_ON_SERVICE_IN_SECONDS,<a name="line.1083"></a>
-<span class="sourceLineNo">1084</span>        DEFAULT_HBASE_MASTER_WAIT_ON_SERVICE_IN_SECONDS), TimeUnit.SECONDS);<a name="line.1084"></a>
-<span class="sourceLineNo">1085</span>    } catch (TimeoutException toe) {<a name="line.1085"></a>
-<span class="sourceLineNo">1086</span>      throw new IOException("Timedout starting ClusterSchemaService", toe);<a name="line.1086"></a>
-<span class="sourceLineNo">1087</span>    }<a name="line.1087"></a>
-<span class="sourceLineNo">1088</span>  }<a name="line.1088"></a>
-<span class="sourceLineNo">1089</span><a name="line.1089"></a>
-<span class="sourceLineNo">1090</span>  void initQuotaManager() throws IOException {<a name="line.1090"></a>
-<span class="sourceLineNo">1091</span>    MasterQuotaManager quotaManager = new MasterQuotaManager(this);<a name="line.1091"></a>
-<span class="sourceLineNo">1092</span>    this.assignmentManager.setRegionStateListener(quotaManager);<a name="line.1092"></a>
-<span class="sourceLineNo">1093</span>    quotaManager.start();<a name="line.1093"></a>
-<span class="sourceLineNo">1094</span>    this.quotaManager = quotaManager;<a name="line.1094"></a>
-<span class="sourceLineNo">1095</span>  }<a name="line.1095"></a>
-<span class="sourceLineNo">1096</span><a name="line.1096"></a>
-<span class="sourceLineNo">1097</span>  SpaceQuotaSnapshotNotifier createQuotaSnapshotNotifier() {<a name="line.1097"></a>
-<span class="sourceLineNo">1098</span>    SpaceQuotaSnapshotNotifier notifier =<a name="line.1098"></a>
-<span class="sourceLineNo">1099</span>        SpaceQuotaSnapshotNotifierFactory.getInstance().create(getConfiguration());<a name="line.1099"></a>
-<span class="sourceLineNo">1100</span>    return notifier;<a name="line.1100"></a>
-<span class="sourceLineNo">1101</span>  }<a name="line.1101"></a>
-<span class="sourceLineNo">1102</span><a name="line.1102"></a>
-<span class="sourceLineNo">1103</span>  boolean isCatalogJanitorEnabled() {<a name="line.1103"></a>
-<span class="sourceLineNo">1104</span>    return catalogJanitorChore != null ?<a name="line.1104"></a>
-<span class="sourceLineNo">1105</span>      catalogJanitorChore.getEnabled() : false;<a name="line.1105"></a>
+<span class="sourceLineNo">1006</span><a name="line.1006"></a>
+<span class="sourceLineNo">1007</span>    /*<a name="line.1007"></a>
+<span class="sourceLineNo">1008</span>     * After master has started up, lets do balancer post startup initialization. Since this runs<a name="line.1008"></a>
+<span class="sourceLineNo">1009</span>     * in activeMasterManager thread, it should be fine.<a name="line.1009"></a>
+<span class="sourceLineNo">1010</span>     */<a name="line.1010"></a>
+<span class="sourceLineNo">1011</span>    long start = System.currentTimeMillis();<a name="line.1011"></a>
+<span class="sourceLineNo">1012</span>    this.balancer.postMasterStartupInitialize();<a name="line.1012"></a>
+<span class="sourceLineNo">1013</span>    if (LOG.isDebugEnabled()) {<a name="line.1013"></a>
+<span class="sourceLineNo">1014</span>      LOG.debug("Balancer post startup initialization complete, took " + (<a name="line.1014"></a>
+<span class="sourceLineNo">1015</span>          (System.currentTimeMillis() - start) / 1000) + " seconds");<a name="line.1015"></a>
+<span class="sourceLineNo">1016</span>    }<a name="line.1016"></a>
+<span class="sourceLineNo">1017</span>  }<a name="line.1017"></a>
+<span class="sourceLineNo">1018</span><a name="line.1018"></a>
+<span class="sourceLineNo">1019</span>  /**<a name="line.1019"></a>
+<span class="sourceLineNo">1020</span>   * Adds the {@code MasterSpaceQuotaObserver} to the list of configured Master observers to<a name="line.1020"></a>
+<span class="sourceLineNo">1021</span>   * automatically remove space quotas for a table when that table is deleted.<a name="line.1021"></a>
+<span class="sourceLineNo">1022</span>   */<a name="line.1022"></a>
+<span class="sourceLineNo">1023</span>  @VisibleForTesting<a name="line.1023"></a>
+<span class="sourceLineNo">1024</span>  public void updateConfigurationForSpaceQuotaObserver(Configuration conf) {<a name="line.1024"></a>
+<span class="sourceLineNo">1025</span>    // We're configured to not delete quotas on table deletion, so we don't need to add the obs.<a name="line.1025"></a>
+<span class="sourceLineNo">1026</span>    if (!conf.getBoolean(<a name="line.1026"></a>
+<span class="sourceLineNo">1027</span>          MasterSpaceQuotaObserver.REMOVE_QUOTA_ON_TABLE_DELETE,<a name="line.1027"></a>
+<span class="sourceLineNo">1028</span>          MasterSpaceQuotaObserver.REMOVE_QUOTA_ON_TABLE_DELETE_DEFAULT)) {<a name="line.1028"></a>
+<span class="sourceLineNo">1029</span>      return;<a name="line.1029"></a>
+<span class="sourceLineNo">1030</span>    }<a name="line.1030"></a>
+<span class="sourceLineNo">1031</span>    String[] masterCoprocs = conf.getStrings(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY);<a name="line.1031"></a>
+<span class="sourceLineNo">1032</span>    final int length = null == masterCoprocs ? 0 : masterCoprocs.length;<a name="line.1032"></a>
+<span class="sourceLineNo">1033</span>    String[] updatedCoprocs = new String[length + 1];<a name="line.1033"></a>
+<span class="sourceLineNo">1034</span>    if (length &gt; 0) {<a name="line.1034"></a>
+<span class="sourceLineNo">1035</span>      System.arraycopy(masterCoprocs, 0, updatedCoprocs, 0, masterCoprocs.length);<a name="line.1035"></a>
+<span class="sourceLineNo">1036</span>    }<a name="line.1036"></a>
+<span class="sourceLineNo">1037</span>    updatedCoprocs[length] = MasterSpaceQuotaObserver.class.getName();<a name="line.1037"></a>
+<span class="sourceLineNo">1038</span>    conf.setStrings(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY, updatedCoprocs);<a name="line.1038"></a>
+<span class="sourceLineNo">1039</span>  }<a name="line.1039"></a>
+<span class="sourceLineNo">1040</span><a name="line.1040"></a>
+<span class="sourceLineNo">1041</span>  private void initMobCleaner() {<a name="line.1041"></a>
+<span class="sourceLineNo">1042</span>    this.expiredMobFileCleanerChore = new ExpiredMobFileCleanerChore(this);<a name="line.1042"></a>
+<span class="sourceLineNo">1043</span>    getChoreService().scheduleChore(expiredMobFileCleanerChore);<a name="line.1043"></a>
+<span class="sourceLineNo">1044</span><a name="line.1044"></a>
+<span class="sourceLineNo">1045</span>    int mobCompactionPeriod = conf.getInt(MobConstants.MOB_COMPACTION_CHORE_PERIOD,<a name="line.1045"></a>
+<span class="sourceLineNo">1046</span>        MobConstants.DEFAULT_MOB_COMPACTION_CHORE_PERIOD);<a name="line.1046"></a>
+<span class="sourceLineNo">1047</span>    if (mobCompactionPeriod &gt; 0) {<a name="line.1047"></a>
+<span class="sourceLineNo">1048</span>      this.mobCompactChore = new MobCompactionChore(this, mobCompactionPeriod);<a name="line.1048"></a>
+<span class="sourceLineNo">1049</span>      getChoreService().scheduleChore(mobCompactChore);<a name="line.1049"></a>
+<span class="sourceLineNo">1050</span>    } else {<a name="line.1050"></a>
+<span class="sourceLineNo">1051</span>      LOG<a name="line.1051"></a>
+<span class="sourceLineNo">1052</span>        .info("The period is " + mobCompactionPeriod + " seconds, MobCompactionChore is disabled");<a name="line.1052"></a>
+<span class="sourceLineNo">1053</span>    }<a name="line.1053"></a>
+<span class="sourceLineNo">1054</span>    this.mobCompactThread = new MasterMobCompactionThread(this);<a name="line.1054"></a>
+<span class="sourceLineNo">1055</span>  }<a name="line.1055"></a>
+<span class="sourceLineNo">1056</span><a name="line.1056"></a>
+<span class="sourceLineNo">1057</span>  /**<a name="line.1057"></a>
+<span class="sourceLineNo">1058</span>   * Create a {@link MasterMetaBootstrap} instance.<a name="line.1058"></a>
+<span class="sourceLineNo">1059</span>   */<a name="line.1059"></a>
+<span class="sourceLineNo">1060</span>  MasterMetaBootstrap createMetaBootstrap(final HMaster master, final MonitoredTask status) {<a name="line.1060"></a>
+<span class="sourceLineNo">1061</span>    // We put this out here in a method so can do a Mockito.spy and stub it out<a name="line.1061"></a>
+<span class="sourceLineNo">1062</span>    // w/ a mocked up MasterMetaBootstrap.<a name="line.1062"></a>
+<span class="sourceLineNo">1063</span>    return new MasterMetaBootstrap(master, status);<a name="line.1063"></a>
+<span class="sourceLineNo">1064</span>  }<a name="line.1064"></a>
+<span class="sourceLineNo">1065</span><a name="line.1065"></a>
+<span class="sourceLineNo">1066</span>  /**<a name="line.1066"></a>
+<span class="sourceLineNo">1067</span>   * Create a {@link ServerManager} instance.<a name="line.1067"></a>
+<span class="sourceLineNo">1068</span>   */<a name="line.1068"></a>
+<span class="sourceLineNo">1069</span>  ServerManager createServerManager(final MasterServices master) throws IOException {<a name="line.1069"></a>
+<span class="sourceLineNo">1070</span>    // We put this out here in a method so can do a Mockito.spy and stub it out<a name="line.1070"></a>
+<span class="sourceLineNo">1071</span>    // w/ a mocked up ServerManager.<a name="line.1071"></a>
+<span class="sourceLineNo">1072</span>    setupClusterConnection();<a name="line.1072"></a>
+<span class="sourceLineNo">1073</span>    return new ServerManager(master);<a name="line.1073"></a>
+<span class="sourceLineNo">1074</span>  }<a name="line.1074"></a>
+<span class="sourceLineNo">1075</span><a name="line.1075"></a>
+<span class="sourceLineNo">1076</span>  private void waitForRegionServers(final MonitoredTask status)<a name="line.1076"></a>
+<span class="sourceLineNo">1077</span>      throws IOException, InterruptedException {<a name="line.1077"></a>
+<span class="sourceLineNo">1078</span>    this.serverManager.waitForRegionServers(status);<a name="line.1078"></a>
+<span class="sourceLineNo">1079</span>    // Check zk for region servers that are up but didn't register<a name="line.1079"></a>
+<span class="sourceLineNo">1080</span>    for (ServerName sn: this.regionServerTracker.getOnlineServers()) {<a name="line.1080"></a>
+<span class="sourceLineNo">1081</span>      // The isServerOnline check is opportunistic, correctness is handled inside<a name="line.1081"></a>
+<span class="sourceLineNo">1082</span>      if (!this.serverManager.isServerOnline(sn) &amp;&amp;<a name="line.1082"></a>
+<span class="sourceLineNo">1083</span>          serverManager.checkAndRecordNewServer(sn, ServerMetricsBuilder.of(sn))) {<a name="line.1083"></a>
+<span class="sourceLineNo">1084</span>        LOG.info("Registered server found up in zk but who has not yet reported in: " + sn);<a name="line.1084"></a>
+<span class="sourceLineNo">1085</span>      }<a name="line.1085"></a>
+<span class="sourceLineNo">1086</span>    }<a name="line.1086"></a>
+<span class="sourceLineNo">1087</span>  }<a name="line.1087"></a>
+<span class="sourceLineNo">1088</span><a name="line.1088"></a>
+<span class="sourceLineNo">1089</span>  void initClusterSchemaService() throws IOException, InterruptedException {<a name="line.1089"></a>
+<span class="sourceLineNo">1090</span>    this.clusterSchemaService = new ClusterSchemaServiceImpl(this);<a name="line.1090"></a>
+<span class="sourceLineNo">1091</span>    this.clusterSchemaService.startAsync();<a name="line.1091"></a>
+<span class="sourceLineNo">1092</span>    try {<a name="line.1092"></a>
+<span class="sourceLineNo">1093</span>      this.clusterSchemaService.awaitRunning(getConfiguration().getInt(<a name="line.1093"></a>
+<span class="sourceLineNo">1094</span>        HBASE_MASTER_WAIT_ON_SERVICE_IN_SECONDS,<a name="line.1094"></a>
+<span class="sourceLineNo">1095</span>        DEFAULT_HBASE_MASTER_WAIT_ON_SERVICE_IN_SECONDS), TimeUnit.SECONDS);<a name="line.1095"></a>
+<span class="sourceLineNo">1096</span>    } catch (TimeoutException toe) {<a name="line.1096"></a>
+<span class="sourceLineNo">1097</span>      throw new IOException("Timedout starting ClusterSchemaService", toe);<a name="line.1097"></a>
+<span class="sourceLineNo">1098</span>    }<a name="line.1098"></a>
+<span class="sourceLineNo">1099</span>  }<a name="line.1099"></a>
+<span class="sourceLineNo">1100</span><a name="line.1100"></a>
+<span class="sourceLineNo">1101</span>  void initQuotaManager() throws IOException {<a name="line.1101"></a>
+<span class="sourceLineNo">1102</span>    MasterQuotaManager quotaManager = new MasterQuotaManager(this);<a name="line.1102"></a>
+<span class="sourceLineNo">1103</span>    this.assignmentManager.setRegionStateListener(quotaManager);<a name="line.1103"></a>
+<span class="sourceLineNo">1104</span>    quotaManager.start();<a name="line.1104"></a>
+<span class="sourceLineNo">1105</span>    this.quotaManager = quotaManager;<a name="line.1105"></a>
 <span class="sourceLineNo">1106</span>  }<a name="line.1106"></a>
 <span class="sourceLineNo">1107</span><a name="line.1107"></a>
-<span class="sourceLineNo">1108</span>  boolean isCleanerChoreEnabled() {<a name="line.1108"></a>
-<span class="sourceLineNo">1109</span>    boolean hfileCleanerFlag = true, logCleanerFlag = true;<a name="line.1109"></a>
-<span class="sourceLineNo">1110</span><a name="line.1110"></a>
-<span class="sourceLineNo">1111</span>    if (hfileCleaner != null) {<a name="line.1111"></a>
-<span class="sourceLineNo">1112</span>      hfileCleanerFlag = hfileCleaner.getEnabled();<a name="line.1112"></a>
-<span class="sourceLineNo">1113</span>    }<a name="line.1113"></a>
-<span class="sourceLineNo">1114</span><a name="line.1114"></a>
-<span class="sourceLineNo">1115</span>    if (logCleaner != null) {<a name="line.1115"></a>
-<span class="sourceLineNo">1116</span>      logCleanerFlag = logCleaner.getEnabled();<a name="line.1116"></a>
-<span class="sourceLineNo">1117</span>    }<a name="line.1117"></a>
+<span class="sourceLineNo">1108</span>  SpaceQuotaSnapshotNotifier createQuotaSnapshotNotifier() {<a name="line.1108"></a>
+<span class="sourceLineNo">1109</span>    SpaceQuotaSnapshotNotifier notifier =<a name="line.1109"></a>
+<span class="sourceLineNo">1110</span>        SpaceQuotaSnapshotNotifierFactory.getInstance().create(getConfiguration());<a name="line.1110"></a>
+<span class="sourceLineNo">1111</span>    return notifier;<a name="line.1111"></a>
+<span class="sourceLineNo">1112</span>  }<a name="line.1112"></a>
+<span class="sourceLineNo">1113</span><a name="line.1113"></a>
+<span class="sourceLineNo">1114</span>  boolean isCatalogJanitorEnabled() {<a name="line.1114"></a>
+<span class="sourceLineNo">1115</span>    return catalogJanitorChore != null ?<a name="line.1115"></a>
+<span class="sourceLineNo">1116</span>      catalogJanitorChore.getEnabled() : false;<a name="line.1116"></a>
+<span class="sourceLineNo">1117</span>  }<a name="line.1117"></a>
 <span class="sourceLineNo">1118</span><a name="line.1118"></a>
-<span class="sourceLineNo">1119</span>    return (hfileCleanerFlag &amp;&amp; logCleanerFlag);<a name="line.1119"></a>
-<span class="sourceLineNo">1120</span>  }<a name="line.1120"></a>
+<span class="sourceLineNo">1119</span>  boolean isCleanerChoreEnabled() {<a name="line.1119"></a>
+<span class="sourceLineNo">1120</span>    boolean hfileCleanerFlag = true, logCleanerFlag = true;<a name="line.1120"></a>
 <span class="sourceLineNo">1121</span><a name="line.1121"></a>
-<span class="sourceLineNo">1122</span>  @Override<a name="line.1122"></a>
-<span class="sourceLineNo">1123</span>  public TableDescriptors getTableDescriptors() {<a name="line.1123"></a>
-<span class="sourceLineNo">1124</span>    return this.tableDescriptors;<a name="line.1124"></a>
-<span class="sourceLineNo">1125</span>  }<a name="line.1125"></a>
-<span class="sourceLineNo">1126</span><a name="line.1126"></a>
-<span class="sourceLineNo">1127</span>  @Override<a name="line.1127"></a>
-<span class="sourceLineNo">1128</span>  public ServerManager getServerManager() {<a name="line.1128"></a>
-<span class="sourceLineNo">1129</span>    return this.serverManager;<a name="line.1129"></a>
-<span class="sourceLineNo">1130</span>  }<a name="line.1130"></a>
-<span class="sourceLineNo">1131</span><a name="line.1131"></a>
-<span class="sourceLineNo">1132</span>  @Override<a name="line.1132"></a>
-<span class="sourceLineNo">1133</span>  public MasterFileSystem getMasterFileSystem() {<a name="line.1133"></a>
-<span class="sourceLineNo">1134</span>    return this.fileSystemManager;<a name="line.1134"></a>
-<span class="sourceLineNo">1135</span>  }<a name="line.1135"></a>
-<span class="sourceLineNo">1136</span><a name="line.1136"></a>
-<span class="sourceLineNo">1137</span>  @Override<a name="line.1137"></a>
-<span class="sourceLineNo">1138</span>  public MasterWalManager getMasterWalManager() {<a name="line.1138"></a>
-<span class="sourceLineNo">1139</span>    return this.walManager;<a name="line.1139"></a>
-<span class="sourceLineNo">1140</span>  }<a name="line.1140"></a>
-<span class="sourceLineNo">1141</span><a name="line.1141"></a>
-<span class="sourceLineNo">1142</span>  @Override<a name="line.1142"></a>
-<span class="sourceLineNo">1143</span>  public TableStateManager getTableStateManager() {<a name="line.1143"></a>
-<span class="sourceLineNo">1144</span>    return tableStateManager;<a name="line.1144"></a>
-<span class="sourceLineNo">1145</span>  }<a name="line.1145"></a>
-<span class="sourceLineNo">1146</span><a name="line.1146"></a>
-<span class="sourceLineNo">1147</span>  /*<a name="line.1147"></a>
-<span class="sourceLineNo">1148</span>   * Start up all services. If any of these threads gets an unhandled exception<a name="line.1148"></a>
-<span class="sourceLineNo">1149</span>   * then they just die with a logged message.  This should be fine because<a name="line.1149"></a>
-<span class="sourceLineNo">1150</span>   * in general, we do not expect the master to get such unhandled exceptions<a name="line.1150"></a>
-<span class="sourceLineNo">1151</span>   *  as OOMEs; it should be lightly loaded. See what HRegionServer does if<a name="line.1151"></a>
-<span class="sourceLineNo">1152</span>   *  need to install an unexpected exception handler.<a name="line.1152"></a>
-<span class="sourceLineNo">1153</span>   */<a name="line.1153"></a>
-<span class="sourceLineNo">1154</span>  private void startServiceThreads() throws IOException{<a name="line.1154"></a>
-<span class="sourceLineNo">1155</span>   // Start the executor service pools<a name="line.1155"></a>
-<span class="sourceLineNo">1156</span>   this.executorService.startExecutorService(ExecutorType.MASTER_OPEN_REGION,<a name="line.1156"></a>
-<span class="sourceLineNo">1157</span>      conf.getInt("hbase.master.executor.openregion.threads", 5));<a name="line.1157"></a>
-<span class="sourceLineNo">1158</span>   this.executorService.startExecutorService(ExecutorType.MASTER_CLOSE_REGION,<a name="line.1158"></a>
-<span class="sourceLineNo">1159</span>      conf.getInt("hbase.master.executor.closeregion.threads", 5));<a name="line.1159"></a>
-<span class="sourceLineNo">1160</span>   this.executorService.startExecutorService(ExecutorType.MASTER_SERVER_OPERATIONS,<a name="line.1160"></a>
-<span class="sourceLineNo">1161</span>      conf.getInt("hbase.master.executor.serverops.threads", 5));<a name="line.1161"></a>
-<span class="sourceLineNo">1162</span>   this.executorService.startExecutorService(ExecutorType.MASTER_META_SERVER_OPERATIONS,<a name="line.1162"></a>
-<span class="sourceLineNo">1163</span>      conf.getInt("hbase.master.executor.meta.serverops.threads", 5));<a name="line.1163"></a>
-<span class="sourceLineNo">1164</span>   this.executorService.startExecutorService(ExecutorType.M_LOG_REPLAY_OPS,<a name="line.1164"></a>
-<span class="sourceLineNo">1165</span>      conf.getInt("hbase.master.executor.logreplayops.threads", 10));<a name="line.1165"></a>
-<span class="sourceLineNo">1166</span><a name="line.1166"></a>
-<span class="sourceLineNo">1167</span>   // We depend on there being only one instance of this executor running<a name="line.1167"></a>
-<span class="sourceLineNo">1168</span>   // at a time.  To do concurrency, would need fencing of enable/disable of<a name="line.1168"></a>
-<span class="sourceLineNo">1169</span>   // tables.<a name="line.1169"></a>
-<span class="sourceLineNo">1170</span>   // Any time changing this maxThreads to &gt; 1, pls see the comment at<a name="line.1170"></a>
-<span class="sourceLineNo">1171</span>   // AccessController#postCompletedCreateTableAction<a name="line.1171"></a>
-<span class="sourceLineNo">1172</span>   this.executorService.startExecutorService(ExecutorType.MASTER_TABLE_OPERATIONS, 1);<a name="line.1172"></a>
-<span class="sourceLineNo">1173</span>   startProcedureExecutor();<a name="line.1173"></a>
-<span class="sourceLineNo">1174</span><a name="line.1174"></a>
-<span class="sourceLineNo">1175</span>    // Initial cleaner chore<a name="line.1175"></a>
-<span class="sourceLineNo">1176</span>    CleanerChore.initChorePool(conf);<a name="line.1176"></a>
-<span class="sourceLineNo">1177</span>   // Start log cleaner thread<a name="line.1177"></a>
-<span class="sourceLineNo">1178</span>   int cleanerInterval = conf.getInt("hbase.master.cleaner.interval", 600 * 1000);<a name="line.1178"></a>
-<span class="sourceLineNo">1179</span>   this.logCleaner =<a name="line.1179"></a>
-<span class="sourceLineNo">1180</span>      new LogCleaner(cleanerInterval,<a name="line.1180"></a>
-<span class="sourceLineNo">1181</span>         this, conf, getMasterWalManager().getFileSystem(),<a name="line.1181"></a>
-<span class="sourceLineNo">1182</span>         getMasterWalManager().getOldLogDir());<a name="line.1182"></a>
-<span class="sourceLineNo">1183</span>    getChoreService().scheduleChore(logCleaner);<a name="line.1183"></a>
-<span class="sourceLineNo">1184</span><a name="line.1184"></a>
-<span class="sourceLineNo">1185</span>    // start the hfile archive cleaner thread<a name="line.1185"></a>
-<span class="sourceLineNo">1186</span>    Path archiveDir = HFileArchiveUtil.getArchivePath(conf);<a name="line.1186"></a>
-<span class="sourceLineNo">1187</span>    Map&lt;String, Object&gt; params = new HashMap&lt;&gt;();<a name="line.1187"></a>
-<span class="sourceLineNo">1188</span>    params.put(MASTER, this);<a name="line.1188"></a>
-<span class="sourceLineNo">1189</span>    this.hfileCleaner = new HFileCleaner(cleanerInterval, this, conf, getMasterFileSystem()<a name="line.1189"></a>
-<span class="sourceLineNo">1190</span>        .getFileSystem(), archiveDir, params);<a name="line.1190"></a>
-<span class="sourceLineNo">1191</span>    getChoreService().scheduleChore(hfileCleaner);<a name="line.1191"></a>
-<span class="sourceLineNo">1192</span><a name="line.1192"></a>
-<span class="sourceLineNo">1193</span>    replicationBarrierCleaner =<a name="line.1193"></a>
-<span class="sourceLineNo">1194</span>      new ReplicationBarrierCleaner(conf, this, getConnection(), replicationPeerManager);<a name="line.1194"></a>
-<span class="sourceLineNo">1195</span>    getChoreService().scheduleChore(replicationBarrierCleaner);<a name="line.1195"></a>
-<span class="sourceLineNo">1196</span><a name="line.1196"></a>
-<span class="sourceLineNo">1197</span>    serviceStarted = true;<a name="line.1197"></a>
-<span class="sourceLineNo">1198</span>    if (LOG.isTraceEnabled()) {<a name="line.1198"></a>
-<span class="sourceLineNo">1199</span>      LOG.trace("Started service threads");<a name="line.1199"></a>
-<span class="sourceLineNo">1200</span>    }<a name="line.1200"></a>
-<span class="sourceLineNo">1201</span>  }<a name="line.1201"></a>
-<span class="sourceLineNo">1202</span><a name="line.1202"></a>
-<span class="sourceLineNo">1203</span>  private void cancelChore(ScheduledChore chore) {<a name="line.1203"></a>
-<span class="sourceLineNo">1204</span>    if (chore != null) {<a name="line.1204"></a>
-<span class="sourceLineNo">1205</span>      chore.cancel();<a name="line.1205"></a>
-<span class="sourceLineNo">1206</span>    }<a name="line.1206"></a>
-<span class="sourceLineNo">1207</span>  }<a name="line.1207"></a>
-<span class="sourceLineNo">1208</span><a name="line.1208"></a>
-<span class="sourceLineNo">1209</span>  @Override<a name="line.1209"></a>
-<span class="sourceLineNo">1210</span>  protected void stopServiceThreads() {<a name="line.1210"></a>
-<span class="sourceLineNo">1211</span>    if (masterJettyServer != null) {<a name="line.1211"></a>
-<span class="sourceLineNo">1212</span>      LOG.info("Stopping master jetty server");<a name="line.1212"></a>
-<span class="sourceLineNo">1213</span>      try {<a name="line.1213"></a>
-<span class="sourceLineNo">1214</span>        masterJettyServer.stop();<a name="line.1214"></a>
-<span class="sourceLineNo">1215</span>      } catch (Exception e) {<a name="line.1215"></a>
-<span class="sourceLineNo">1216</span>        LOG.error("Failed to stop master jetty server", e);<a name="line.1216"></a>
-<span class="sourceLineNo">1217</span>      }<a name="line.1217"></a>
-<span class="sourceLineNo">1218</span>    }<a name="line.1218"></a>
-<span class="sourceLineNo">1219</span>    super.stopServiceThreads();<a name="line.1219"></a>
-<span class="sourceLineNo">1220</span>    stopChores();<a name="line.1220"></a>
-<span class="sourceLineNo">1221</span><a name="line.1221"></a>
-<span class="sourceLineNo">1222</span>    LOG.debug("Stopping service threads");<a name="line.1222"></a>
-<span class="sourceLineNo">1223</span><a name="line.1223"></a>
-<span class="sourceLineNo">1224</span>    if (this.quotaManager != null) {<a name="line.1224"></a>
-<span class="sourceLineNo">1225</span>      this.quotaManager.stop();<a name="line.1225"></a>
-<span class="sourceLineNo">1226</span>    }<a name="line.1226"></a>
-<span class="sourceLineNo">1227</span><a name="line.1227"></a>
-<span class="sourceLineNo">1228</span>    if (this.activeMasterManager != null) {<a name="line.1228"></a>
-<span class="sourceLineNo">1229</span>      this.activeMasterManager.stop();<a name="line.1229"></a>
-<span class="sourceLineNo">1230</span>    }<a name="line.1230"></a>
-<span class="sourceLineNo">1231</span>    if (this.serverManager != null) {<a name="line.1231"></a>
-<span class="sourceLineNo">1232</span>      this.serverManager.stop();<a name="line.1232"></a>
-<span class="sourceLineNo">1233</span>    }<a name="line.1233"></a>
-<span class="sourceLineNo">1234</span>    if (this.assignmentManager != null) {<a name="line.1234"></a>
-<span class="sourceLineNo">1235</span>      this.assignmentManager.stop();<a name="line.1235"></a>
-<span class="sourceLineNo">1236</span>    }<a name="line.1236"></a>
-<span class="sourceLineNo">1237</span><a name="line.1237"></a>
-<span class="sourceLineNo">1238</span>    stopProcedureExecutor();<a name="line.1238"></a>
-<span class="sourceLineNo">1239</span><a name="line.1239"></a>
-<span class="sourceLineNo">1240</span>    if (this.walManager != null) {<a name="line.1240"></a>
-<span class="sourceLineNo">1241</span>      this.walManager.stop();<a name="line.1241"></a>
-<span class="sourceLineNo">1242</span>    }<a name="line.1242"></a>
-<span class="sourceLineNo">1243</span>    if (this.fileSystemManager != null) {<a name="line.1243"></a>
-<span class="sourceLineNo">1244</span>      this.fileSystemManager.stop();<a name="line.1244"></a>
-<span class="sourceLineNo">1245</span>    }<a name="line.1245"></a>
-<span class="sourceLineNo">1246</span>    if (this.mpmHost != null) {<a name="line.1246"></a>
-<span class="sourceLineNo">1247</span>      this.mpmHost.stop("server shutting down.");<a name="line.1247"></a>
-<span class="sourceLineNo">1248</span>    }<a name="line.1248"></a>
-<span class="sourceLineNo">1249</span>  }<a name="line.1249"></a>
+<span class="sourceLineNo">1122</span>    if (hfileCleaner != null) {<a name="line.1122"></a>
+<span class="sourceLineNo">1123</span>      hfileCleanerFlag = hfileCleaner.getEnabled();<a name="line.1123"></a>
+<span class="sourceLineNo">1124</span>    }<a name="line.1124"></a>
+<span class="sourceLineNo">1125</span><a name="line.1125"></a>
+<span class="sourceLineNo">1126</span>    if (logCleaner != null) {<a name="line.1126"></a>
+<span class="sourceLineNo">1127</span>      logCleanerFlag = logCleaner.getEnabled();<a name="line.1127"></a>
+<span class="sourceLineNo">1128</span>    }<a name="line.1128"></a>
+<span class="sourceLineNo">1129</span><a name="line.1129"></a>
+<span class="sourceLineNo">1130</span>    return (hfileCleanerFlag &amp;&amp; logCleanerFlag);<a name="line.1130"></a>
+<span class="sourceLineNo">1131</span>  }<a name="line.1131"></a>
+<span class="sourceLineNo">1132</span><a name="line.1132"></a>
+<span class="sourceLineNo">1133</span>  @Override<a name="line.1133"></a>
+<span class="sourceLineNo">1134</span>  public TableDescriptors getTableDescriptors() {<a name="line.1134"></a>
+<span class="sourceLineNo">1135</span>    return this.tableDescriptors;<a name="line.1135"></a>
+<span class="sourceLineNo">1136</span>  }<a name="line.1136"></a>
+<span class="sourceLineNo">1137</span><a name="line.1137"></a>
+<span class="sourceLineNo">1138</span>  @Override<a name="line.1138"></a>
+<span class="sourceLineNo">1139</span>  public ServerManager getServerManager() {<a name="line.1139"></a>
+<span class="sourceLineNo">1140</span>    return this.serverManager;<a name="line.1140"></a>
+<span class="sourceLineNo">1141</span>  }<a name="line.1141"></a>
+<span class="sourceLineNo">1142</span><a name="line.1142"></a>
+<span class="sourceLineNo">1143</span>  @Override<a name="line.1143"></a>
+<span class="sourceLineNo">1144</span>  public MasterFileSystem getMasterFileSystem() {<a name="line.1144"></a>
+<span class="sourceLineNo">1145</span>    return this.fileSystemManager;<a name="line.1145"></a>
+<span class="sourceLineNo">1146</span>  }<a name="line.1146"></a>
+<span class="sourceLineNo">1147</span><a name="line.1147"></a>
+<span class="sourceLineNo">1148</span>  @Override<a name="line.1148"></a>
+<span class="sourceLineNo">1149</span>  public MasterWalManager getMasterWalManager() {<a name="line.1149"></a>
+<span class="sourceLineNo">1150</span>    return this.walManager;<a name="line.1150"></a>
+<span class="sourceLineNo">1151</span>  }<a name="line.1151"></a>
+<span class="sourceLineNo">1152</span><a name="line.1152"></a>
+<span class="sourceLineNo">1153</span>  @Override<a name="line.1153"></a>
+<span class="sourceLineNo">1154</span>  public TableStateManager getTableStateManager() {<a name="line.1154"></a>
+<span class="sourceLineNo">1155</span>    return tableStateManager;<a name="line.1155"></a>
+<span class="sourceLineNo">1156</span>  }<a name="line.1156"></a>
+<span class="sourceLineNo">1157</span><a name="line.1157"></a>
+<span class="sourceLineNo">1158</span>  /*<a name="line.1158"></a>
+<span class="sourceLineNo">1159</span>   * Start up all services. If any of these threads gets an unhandled exception<a name="line.1159"></a>
+<span class="sourceLineNo">1160</span>   * then they just die with a logged message.  This should be fine because<a name="line.1160"></a>
+<span class="sourceLineNo">1161</span>   * in general, we do not expect the master to get such unhandled exceptions<a name="line.1161"></a>
+<span class="sourceLineNo">1162</span>   *  as OOMEs; it should be lightly loaded. See what HRegionServer does if<a name="line.1162"></a>
+<span class="sourceLineNo">1163</span>   *  need to install an unexpected exception handler.<a name="line.1163"></a>
+<span class="sourceLineNo">1164</span>   */<a name="line.1164"></a>
+<span class="sourceLineNo">1165</span>  private void startServiceThreads() throws IOException{<a name="line.1165"></a>
+<span class="sourceLineNo">1166</span>   // Start the executor service pools<a name="line.1166"></a>
+<span class="sourceLineNo">1167</span>   this.executorService.startExecutorService(ExecutorType.MASTER_OPEN_REGION,<a name="line.1167"></a>
+<span class="sourceLineNo">1168</span>      conf.getInt("hbase.master.executor.openregion.threads", 5));<a name="line.1168"></a>
+<span class="sourceLineNo">1169</span>   this.executorService.startExecutorService(ExecutorType.MASTER_CLOSE_REGION,<a name="line.1169"></a>
+<span class="sourceLineNo">1170</span>      conf.getInt("hbase.master.executor.closeregion.threads", 5));<a name="line.1170"></a>
+<span class="sourceLineNo">1171</span>   this.executorService.startExecutorService(ExecutorType.MASTER_SERVER_OPERATIONS,<a name="line.1171"></a>
+<span class="sourceLineNo">1172</span>      conf.getInt("hbase.master.executor.serverops.threads", 5));<a name="line.1172"></a>
+<span class="sourceLineNo">1173</span>   this.executorService.startExecutorService(ExecutorType.MASTER_META_SERVER_OPERATIONS,<a name="line.1173"></a>
+<span class="sourceLineNo">1174</span>      conf.getInt("hbase.master.executor.meta.serverops.threads", 5));<a name="line.1174"></a>
+<span class="sourceLineNo">1175</span>   this.executorService.startExecutorService(ExecutorType.M_LOG_REPLAY_OPS,<a name="line.1175"></a>
+<span class="sourceLineNo">1176</span>      conf.getInt("hbase.master.executor.logreplayops.threads", 10));<a name="line.1176"></a>
+<span class="sourceLineNo">1177</span><a name="line.1177"></a>
+<span class="sourceLineNo">1178</span>   // We depend on there being only one instance of this executor running<a name="line.1178"></a>
+<span class="sourceLineNo">1179</span>   // at a time.  To do concurrency, would need fencing of enable/disable of<a name="line.1179"></a>
+<span class="sourceLineNo">1180</span>   // tables.<a name="line.1180"></a>
+<span class="sourceLineNo">1181</span>   // Any time changing this maxThreads to &gt; 1, pls see the comment at<a name="line.1181"></a>
+<span class="sourceLineNo">1182</span>   // AccessController#postCompletedCreateTableAction<a name="line.1182"></a>
+<span class="sourceLineNo">1183</span>   this.executorService.startExecutorService(ExecutorType.MASTER_TABLE_OPERATIONS, 1);<a name="line.1183"></a>
+<span class="sourceLineNo">1184</span>   startProcedureExecutor();<a name="line.1184"></a>
+<span class="sourceLineNo">1185</span><a name="line.1185"></a>
+<span class="sourceLineNo">1186</span>    // Initial cleaner chore<a name="line.1186"></a>
+<span class="sourceLineNo">1187</span>    CleanerChore.initChorePool(conf);<a name="line.1187"></a>
+<span class="sourceLineNo">1188</span>   // Start log cleaner thread<a name="line.1188"></a>
+<span class="sourceLineNo">1189</span>   int cleanerInterval = conf.getInt("hbase.master.cleaner.interval", 600 * 1000);<a name="line.1189"></a>
+<span class="sourceLineNo">1190</span>   this.logCleaner =<a name="line.1190"></a>
+<span class="sourceLineNo">1191</span>      new LogCleaner(cleanerInterval,<a name="line.1191"></a>
+<span class="sourceLineNo">1192</span>         this, conf, getMasterWalManager().getFileSystem(),<a name="line.1192"></a>
+<span class="sourceLineNo">1193</span>         getMasterWalManager().getOldLogDir());<a name="line.1193"></a>
+<span class="sourceLineNo">1194</span>    getChoreService().scheduleChore(logCleaner);<a name="line.1194"></a>
+<span class="sourceLineNo">1195</span><a name="line.1195"></a>
+<span class="sourceLineNo">1196</span>    // start the hfile archive cleaner thread<a name="line.1196"></a>
+<span class="sourceLineNo">1197</span>    Path archiveDir = HFileArchiveUtil.getArchivePath(conf);<a name="line.1197"></a>
+<span class="sourceLineNo">1198</span>    Map&lt;String, Object&gt; params = new HashMap&lt;&gt;();<a name="line.1198"></a>
+<span class="sourceLineNo">1199</span>    params.put(MASTER, this);<a name="line.1199"></a>
+<span class="sourceLineNo">1200</span>    this.hfileCleaner = new HFileCleaner(cleanerInterval, this, conf, getMasterFileSystem()<a name="line.1200"></a>
+<span class="sourceLineNo">1201</span>        .getFileSystem(), archiveDir, params);<a name="line.1201"></a>
+<span class="sourceLineNo">1202</span>    getChoreService().scheduleChore(hfileCleaner);<a name="line.1202"></a>
+<span class="sourceLineNo">1203</span><a name="line.1203"></a>
+<span class="sourceLineNo">1204</span>    replicationBarrierCleaner =<a name="line.1204"></a>
+<span class="sourceLineNo">1205</span>      new ReplicationBarrierCleaner(conf, this, getConnection(), replicationPeerManager);<a name="line.1205"></a>
+<span class="sourceLineNo">1206</span>    getChoreService().scheduleChore(replicationBarrierCleaner);<a name="line.1206"></a>
+<span class="sourceLineNo">1207</span><a name="line.1207"></a>
+<span class="sourceLineNo">1208</span>    serviceStarted = true;<a name="line.1208"></a>
+<span class="sourceLineNo">1209</span>    if (LOG.isTraceEnabled()) {<a name="line.1209"></a>
+<span class="sourceLineNo">1210</span>      LOG.trace("Started service threads");<a name="line.1210"></a>
+<span class="sourceLineNo">1211</span>    }<a name="line.1211"></a>
+<span class="sourceLineNo">1212</span>  }<a name="line.1212"></a>
+<span class="sourceLineNo">1213</span><a name="line.1213"></a>
+<span class="sourceLineNo">1214</span>  private void cancelChore(ScheduledChore chore) {<a name="line.1214"></a>
+<span class="sourceLineNo">1215</span>    if (chore != null) {<a name="line.1215"></a>
+<span class="sourceLineNo">1216</span>      chore.cancel();<a name="line.1216"></a>
+<span class="sourceLineNo">1217</span>    }<a name="line.1217"></a>
+<span class="sourceLineNo">1218</span>  }<a name="line.1218"></a>
+<span class="sourceLineNo">1219</span><a name="line.1219"></a>
+<span class="sourceLineNo">1220</span>  @Override<a name="line.1220"></a>
+<span class="sourceLineNo">1221</span>  protected void stopServiceThreads() {<a name="line.1221"></a>
+<span class="sourceLineNo">1222</span>    if (masterJettyServer != null) {<a name="line.1222"></a>
+<span class="sourceLineNo">1223</span>      LOG.info("Stopping master jetty server");<a name="line.1223"></a>
+<span class="sourceLineNo">1224</span>      try {<a name="line.1224"></a>
+<span class="sourceLineNo">1225</span>        masterJettyServer.stop();<a name="line.1225"></a>
+<span class="sourceLineNo">1226</span>      } catch (Exception e) {<a name="line.1226"></a>
+<span class="sourceLineNo">1227</span>        LOG.error("Failed to stop master jetty server", e);<a name="line.1227"></a>
+<span class="sourceLineNo">1228</span>      }<a name="line.1228"></a>
+<span class="sourceLineNo">1229</span>    }<a name="line.1229"></a>
+<span class="sourceLineNo">1230</span>    super.stopServiceThreads();<a name="line.1230"></a>
+<span class="sourceLineNo">1231</span>    stopChores();<a name="line.1231"></a>
+<span class="sourceLineNo">1232</span><a name="line.1232"></a>
+<span class="sourceLineNo">1233</span>    LOG.debug("Stopping service threads");<a name="line.1233"></a>
+<span class="sourceLineNo">1234</span><a name="line.1234"></a>
+<span class="sourceLineNo">1235</span>    if (this.quotaManager != null) {<a name="line.1235"></a>
+<span class="sourceLineNo">1236</span>      this.quotaManager.stop();<a name="line.1236"></a>
+<span class="sourceLineNo">1237</span>    }<a name="line.1237"></a>
+<span class="sourceLineNo">1238</span><a name="line.1238"></a>
+<span class="sourceLineNo">1239</span>    if (this.activeMasterManager != null) {<a name="line.1239"></a>
+<span class="sourceLineNo">1240</span>      this.activeMasterManager.stop();<a name="line.1240"></a>
+<span class="sourceLineNo">1241</span>    }<a name="line.1241"></a>
+<span class="sourceLineNo">1242</span>    if (this.serverManager != null) {<a name="line.1242"></a>
+<span class="sourceLineNo">1243</span>      this.serverManager.stop();<a name="line.1243"></a>
+<span class="sourceLineNo">1244</span>    }<a name="line.1244"></a>
+<span class="sourceLineNo">1245</span>    if (this.assignmentManager != null) {<a name="line.1245"></a>
+<span class="sourceLineNo">1246</span>      this.assignmentManager.stop();<a name="line.1246"></a>
+<span class="sourceLineNo">1247</span>    }<a name="line.1247"></a>
+<span class="sourceLineNo">1248</span><a name="line.1248"></a>
+<span class="sourceLineNo">1249</span>    stopProcedureExecutor();<a name="line.1249"></a>
 <span class="sourceLineNo">1250</span><a name="line.1250"></a>
-<span class="sourceLineNo">1251</span>  private void startProcedureExecutor() throws IOException {<a name="line.1251"></a>
-<span class="sourceLineNo">1252</span>    final MasterProcedureEnv procEnv = new MasterProcedureEnv(this);<a name="line.1252"></a>
-<span class="sourceLineNo">1253</span>    procedureStore = new WALProcedureStore(conf,<a name="line.1253"></a>
-<span class="sourceLineNo">1254</span>        new MasterProcedureEnv.WALStoreLeaseRecovery(this));<a name="line.1254"></a>
-<span class="sourceLineNo">1255</span>    procedureStore.registerListener(new MasterProcedureEnv.MasterProcedureStoreListener(this));<a name="line.1255"></a>
-<span class="sourceLineNo">1256</span>    MasterProcedureScheduler procedureScheduler = procEnv.getProcedureScheduler();<a name="line.1256"></a>
-<span class="sourceLineNo">1257</span>    procedureExecutor = new ProcedureExecutor&lt;&gt;(conf, procEnv, procedureStore, procedureScheduler);<a name="line.1257"></a>
-<span class="sourceLineNo">1258</span>    configurationManager.registerObserver(procEnv);<a name="line.1258"></a>
-<span class="sourceLineNo">1259</span><a name="line.1259"></a>
-<span class="sourceLineNo">1260</span>    int cpus = Runtime.getRuntime().availableProcessors();<a name="line.1260"></a>
-<span class="sourceLineNo">1261</span>    final int numThreads = conf.getInt(MasterProcedureConstants.MASTER_PROCEDURE_THREADS, Math.max(<a name="line.1261"></a>
-<span class="sourceLineNo">1262</span>      (cpus &gt; 0 ? cpus / 4 : 0), MasterProcedureConstants.DEFAULT_MIN_MASTER_PROCEDURE_THREADS));<a name="line.1262"></a>
-<span class="sourceLineNo">1263</span>    final boolean abortOnCorruption =<a name="line.1263"></a>
-<span class="sourceLineNo">1264</span>      conf.getBoolean(MasterProcedureConstants.EXECUTOR_ABORT_ON_CORRUPTION,<a name="line.1264"></a>
-<span class="sourceLineNo">1265</span>        MasterProcedureConstants.DEFAULT_EXECUTOR_ABORT_ON_CORRUPTION);<a name="line.1265"></a>
-<span class="sourceLineNo">1266</span>    procedureStore.start(numThreads);<a name="line.1266"></a>
-<span class="sourceLineNo">1267</span>    procedureExecutor.start(numThreads, abortOnCorruption);<a name="line.1267"></a>
-<span class="sourceLineNo">1268</span>    procEnv.getRemoteDispatcher().start();<a name="line.1268"></a>
-<span class="sourceLineNo">1269</span>  }<a name="line.1269"></a>
+<span class="sourceLineNo">1251</span>    if (this.walManager != null) {<a name="line.1251"></a>
+<span class="sourceLineNo">1252</span>      this.walManager.stop();<a name="line.1252"></a>
+<span class="sourceLineNo">1253</span>    }<a name="line.1253"></a>
+<span class="sourceLineNo">1254</span>    if (this.fileSystemManager != null) {<a name="line.1254"></a>
+<span class="sourceLineNo">1255</span>      this.fileSystemManager.stop();<a name="line.1255"></a>
+<span class="sourceLineNo">1256</span>    }<a name="line.1256"></a>
+<span class="sourceLineNo">1257</span>    if (this.mpmHost != null) {<a name="line.1257"></a>
+<span class="sourceLineNo">1258</span>      this.mpmHost.stop("server shutting down.");<a name="line.1258"></a>
+<span class="sourceLineNo">1259</span>    }<a name="line.1259"></a>
+<span class="sourceLineNo">1260</span>  }<a name="line.1260"></a>
+<span class="sourceLineNo">1261</span><a name="line.1261"></a>
+<span class="sourceLineNo">1262</span>  private void startProcedureExecutor() throws IOException {<a name="line.1262"></a>
+<span class="sourceLineNo">1263</span>    final MasterProcedureEnv procEnv = new MasterProcedureEnv(this);<a name="line.1263"></a>
+<span class="sourceLineNo">1264</span>    procedureStore = new WALProcedureStore(conf,<a name="line.1264"></a>
+<span class="sourceLineNo">1265</span>        new MasterProcedureEnv.WALStoreLeaseRecovery(this));<a name="line.1265"></a>
+<span class="sourceLineNo">1266</span>    procedureStore.registerListener(new MasterProcedureEnv.MasterProcedureStoreListener(this));<a name="line.1266"></a>
+<span class="sourceLineNo">1267</span>    MasterProcedureScheduler procedureScheduler = procEnv.getProcedureScheduler();<a name="line.1267"></a>
+<span class="sourceLineNo">1268</span>    procedureExecutor = new ProcedureExecutor&lt;&gt;(conf, procEnv, procedureStore, procedureScheduler);<a name="line.1268"></a>
+<span class="sourceLineNo">1269</span>    configurationManager.registerObserver(procEnv);<a name="line.1269"></a>
 <span class="sourceLineNo">1270</span><a name="line.1270"></a>
-<span class="sourceLineNo">1271</span>  private void stopProcedureExecutor() {<a name="line.1271"></a>
-<span class="sourceLineNo">1272</span>    if (procedureExecutor != null) {<a name="line.1272"></a>
-<span class="sourceLineNo">1273</span>      configurationManager.deregisterObserver(procedureExecutor.getEnvironment());<a name="line.1273"></a>
-<span class="sourceLineNo">1274</span>      procedureExecutor.getEnvironment().getRemoteDispatcher().stop();<a name="line.1274"></a>
-<span class="sourceLineNo">1275</span>      procedureExecutor.stop();<a name="line.1275"></a>
-<span class="sourceLineNo">1276</span>      procedureExecutor.join();<a name="line.1276"></a>
-<span class="sourceLineNo">1277</span>      procedureExecutor = null;<a name="line.1277"></a>
-<span class="sourceLineNo">1278</span>    }<a name="line.1278"></a>
-<span class="sourceLineNo">1279</span><a name="line.1279"></a>
-<span class="sourceLineNo">1280</span>    if (procedureStore != null) {<a name="line.1280"></a>
-<span class="sourceLineNo">1281</span>      procedureStore.stop(isAborted());<a name="line.1281"></a>
-<span class="sourceLineNo">1282</span>      procedureStore = null;<a name="line.1282"></a>
-<span class="sourceLineNo">1283</span>    }<a name="line.1283"></a>
-<span class="sourceLineNo">1284</span>  }<a name="line.1284"></a>
-<span class="sourceLineNo">1285</span><a name="line.1285"></a>
-<span class="sourceLineNo">1286</span>  private void stopChores() {<a name="line.1286"></a>
-<span class="sourceLineNo">1287</span>    cancelChore(this.expiredMobFileCleanerChore);<a name="line.1287"></a>
-<span class="sourceLineNo">1288</span>    cancelChore(this.mobCompactChore);<a name="line.1288"></a>
-<span class="sourceLineNo">1289</span>    cancelChore(this.balancerChore);<a name="line.1289"></a>
-<span class="sourceLineNo">1290</span>    cancelChore(this.normalizerChore);<a name="line.1290"></a>
-<span class="sourceLineNo">1291</span>    cancelChore(this.clusterStatusChore);<a name="line.1291"></a>
-<span class="sourceLineNo">1292</span>    cancelChore(this.catalogJanitorChore);<a name="line.1292"></a>
-<span class="sourceLineNo">1293</span>    cancelChore(this.clusterStatusPublisherChore);<a name="line.1293"></a>
-<span class="sourceLineNo">1294</span>    if (this.mobCompactThread != null) {<a name="line.1294"></a>
-<span class="sourceLineNo">1295</span>      this.mobCompactThread.close();<a name="line.1295"></a>
-<span class="sourceLineNo">1296</span>    }<a name="line.1296"></a>
-<span class="sourceLineNo">1297</span>    cancelChore(this.clusterStatusPublisherChore);<a name="line.1297"></a>
-<span class="sourceLineNo">1298</span>    cancelChore(this.snapshotQuotaChore);<a name="line.1298"></a>
-<span class="sourceLineNo">1299</span>    cancelChore(this.logCleaner);<a name="line.1299"></a>
-<span class="sourceLineNo">1300</span>    cancelChore(this.hfileCleaner);<a name="line.1300"></a>
-<span class="sourceLineNo">1301</span>    cancelChore(this.replicationBarrierCleaner);<a name="line.1301"></a>
-<span class="sourceLineNo">1302</span>  }<a name="line.1302"></a>
-<span class="sourceLineNo">1303</span><a name="line.1303"></a>
-<span class="sourceLineNo">1304</span>  /**<a name="line.1304"></a>
-<span class="sourceLineNo">1305</span>   * @return Get remote side's InetAddress<a name="line.1305"></a>
-<span class="sourceLineNo">1306</span>   */<a name="line.1306"></a>
-<span class="sourceLineNo">1307</span>  InetAddress getRemoteInetAddress(final int port,<a name="line.1307"></a>
-<span class="sourceLineNo">1308</span>      final long serverStartCode) throws UnknownHostException {<a name="line.1308"></a>
-<span class="sourceLineNo">1309</span>    // Do it out here in its own little method so can fake an address when<a name="line.1309"></a>
-<span class="sourceLineNo">1310</span>    // mocking up in tests.<a name="line.1310"></a>
-<span class="sourceLineNo">1311</span>    InetAddress ia = RpcServer.getRemoteIp();<a name="line.1311"></a>
-<span class="sourceLineNo">1312</span><a name="line.1312"></a>
-<span class="sourceLineNo">1313</span>    // The call could be from the local regionserver,<a name="line.1313"></a>
-<span class="sourceLineNo">1314</span>    // in which case, there is no remote address.<a name="line.1314"></a>
-<span class="sourceLineNo">1315</span>    if (ia == null &amp;&amp; serverStartCode == startcode) {<a name="line.1315"></a>
-<span class="sourceLineNo">1316</span>      InetSocketAddress isa = rpcServices.getSocketAddress();<a name="line.1316"></a>
-<span class="sourceLineNo">1317</span>      if (isa != null &amp;&amp; isa.getPort() == port) {<a name="line.1317"></a>
-<span class="sourceLineNo">1318</span>        ia = isa.getAddress();<a name="line.1318"></a>
-<span class="sourceLineNo">1319</span>      }<a name="line.1319"></a>
-<span class="sourceLineNo">1320</span>    }<a name="line.1320"></a>
-<span class="sourceLineNo">1321</span>    return ia;<a name="line.1321"></a>
-<span class="sourceLineNo">1322</span>  }<a name="line.1322"></a>
+<span class="sourceLineNo">1271</span>    int cpus = Runtime.getRuntime().availableProcessors();<a name="line.1271"></a>
+<span class="sourceLineNo">1272</span>    final int numThreads = conf.getInt(MasterProcedureConstants.MASTER_PROCEDURE_THREADS, Math.max(<a name="line.1272"></a>
+<span class="sourceLineNo">1273</span>      (cpus &gt; 0 ? cpus / 4 : 0), MasterProcedureConstants.DEFAULT_MIN_MASTER_PROCEDURE_THREADS));<a name="line.1273"></a>
+<span class="sourceLineNo">1274</span>    final boolean abortOnCorruption =<a name="line.1274"></a>
+<span class="sourceLineNo">1275</span>      conf.getBoolean(MasterProcedureConstants.EXECUTOR_ABORT_ON_CORRUPTION,<a name="line.1275"></a>
+<span class="sourceLineNo">1276</span>        MasterProcedureConstants.DEFAULT_EXECUTOR_ABORT_ON_CORRUPTION);<a name="line.1276"></a>
+<span class="sourceLineNo">1277</span>    procedureStore.start(numThreads);<a name="line.1277"></a>
+<span class="sourceLineNo">1278</span>    procedureExecutor.start(numThreads, abortOnCorruption);<a name="line.1278"></a>
+<span class="sourceLineNo">1279</span>    procEnv.getRemoteDispatcher().start();<a name="line.1279"></a>
+<span class="sourceLineNo">1280</span>  }<a name="line.1280"></a>
+<span class="sourceLineNo">1281</span><a name="line.1281"></a>
+<span class="sourceLineNo">1282</span>  private void stopProcedureExecutor() {<a name="line.1282"></a>
+<span class="sourceLineNo">1283</span>    if (procedureExecutor != null) {<a name="line.1283"></a>
+<span class="sourceLineNo">1284</span>      configurationManager.deregisterObserver(procedureExecutor.getEnvironment());<a name="line.1284"></a>
+<span class="sourceLineNo">1285</span>      procedureExecutor.getEnvironment().getRemoteDispatcher().stop();<a name="line.1285"></a>
+<span class="sourceLineNo">1286</span>      procedureExecutor.stop();<a name="line.1286"></a>
+<span class="sourceLineNo">1287</span>      procedureExecutor.join();<a name="line.1287"></a>
+<span class="sourceLineNo">1288</span>      procedureExecutor = null;<a name="line.1288"></a>
+<span class="sourceLineNo">1289</span>    }<a name="line.1289"></a>
+<span class="sourceLineNo">1290</span><a name="line.1290"></a>
+<span class="sourceLineNo">1291</span>    if (procedureStore != null) {<a name="line.1291"></a>
+<span class="sourceLineNo">1292</span>      procedureStore.stop(isAborted());<a name="line.1292"></a>
+<span class="sourceLineNo">1293</span>      procedureStore = null;<a name="line.1293"></a>
+<span class="sourceLineNo">1294</span>    }<a name="line.1294"></a>
+<span class="sourceLineNo">1295</span>  }<a name="line.1295"></a>
+<span class="sourceLineNo">1296</span><a name="line.1296"></a>
+<span class="sourceLineNo">1297</span>  private void stopChores() {<a name="line.1297"></a>
+<span class="sourceLineNo">1298</span>    cancelChore(this.expiredMobFileCleanerChore);<a name="line.1298"></a>
+<span class="sourceLineNo">1299</span>    cancelChore(this.mobCompactChore);<a name="line.1299"></a>
+<span class="sourceLineNo">1300</span>    cancelChore(this.balancerChore);<a name="line.1300"></a>
+<span class="sourceLineNo">1301</span>    cancelChore(this.normalizerChore);<a name="line.1301"></a>
+<span class="sourceLineNo">1302</span>    cancelChore(this.clusterStatusChore);<a name="line.1302"></a>
+<span class="sourceLineNo">1303</span>    cancelChore(this.catalogJanitorChore);<a name="line.1303"></a>
+<span class="sourceLineNo">1304</span>    cancelChore(this.clusterStatusPublisherChore);<a name="line.1304"></a>
+<span class="sourceLineNo">1305</span>    if (this.mobCompactThread != null) {<a name="line.1305"></a>
+<span class="sourceLineNo">1306</span>      this.mobCompactThread.close();<a name="line.1306"></a>
+<span class="sourceLineNo">1307</span>    }<a name="line.1307"></a>
+<span class="sourceLineNo">1308</span>    cancelChore(this.clusterStatusPublisherChore);<a name="line.1308"></a>
+<span class="sourceLineNo">1309</span>    cancelChore(this.snapshotQuotaChore);<a name="line.1309"></a>
+<span class="sourceLineNo">1310</span>    cancelChore(this.logCleaner);<a name="line.1310"></a>
+<span class="sourceLineNo">1311</span>    cancelChore(this.hfileCleaner);<a name="line.1311"></a>
+<span class="sourceLineNo">1312</span>    cancelChore(this.replicationBarrierCleaner);<a name="line.1312"></a>
+<span class="sourceLineNo">1313</span>  }<a name="line.1313"></a>
+<span class="sourceLineNo">1314</span><a name="line.1314"></a>
+<span class="sourceLineNo">1315</span>  /**<a name="line.1315"></a>
+<span class="sourceLineNo">1316</span>   * @return Get remote side's InetAddress<a name="line.1316"></a>
+<span class="sourceLineNo">1317</span>   */<a name="line.1317"></a>
+<span class="sourceLineNo">1318</span>  InetAddress getRemoteInetAddress(final int port,<a name="line.1318"></a>
+<span class="sourceLineNo">1319</span>      final long serverStartCode) throws UnknownHostException {<a name="line.1319"></a>
+<span class="sourceLineNo">1320</span>    // Do it out here in its own little method so can fake an address when<a name="line.1320"></a>
+<span class="sourceLineNo">1321</span>    // mocking up in tests.<a name="line.1321"></a>
+<span class="sourceLineNo">1322</span>    InetAddress ia = RpcServer.getRemoteIp();<a name="line.1322"></a>
 <span class="sourceLineNo">1323</span><a name="line.1323"></a>
-<span class="sourceLineNo">1324</span>  /**<a name="line.1324"></a>
-<span class="sourceLineNo">1325</span>   * @return Maximum time we should run balancer for<a name="line.1325"></a>
-<span class="sourceLineNo">1326</span>   */<a name="line.1326"></a>
-<span class="sourceLineNo">1327</span>  private int getMaxBalancingTime() {<a name="line.1327"></a>
-<span class="sourceLineNo">1328</span>    int maxBalancingTime = getConfiguration().getInt(HConstants.HBASE_BALANCER_MAX_BALANCING, -1);<a name="line.1328"></a>
-<span class="sourceLineNo">1329</span>    if (maxBalancingTime == -1) {<a name="line.1329"></a>
-<span class="sourceLineNo">1330</span>      // if max balancing time isn't set, defaulting it to period time<a name="line.1330"></a>
-<span class="sourceLineNo">1331</span>      maxBalancingTime = getConfiguration().getInt(HConstants.HBASE_BALANCER_PERIOD,<a name="line.1331"></a>
-<span class="sourceLineNo">1332</span>        HConstants.DEFAULT_HBASE_BALANCER_PERIOD);<a name="line.1332"></a>
-<span class="sourceLineNo">1333</span>    }<a name="line.1333"></a>
-<span class="sourceLineNo">1334</span>    return maxBalancingTime;<a name="line.1334"></a>
-<span class="sourceLineNo">1335</span>  }<a name="line.1335"></a>
-<span class="sourceLineNo">1336</span><a name="line.1336"></a>
-<span class="sourceLineNo">1337</span>  /**<a name="line.1337"></a>
-<span class="sourceLineNo">1338</span>   * @return Maximum number of regions in transition<a name="line.1338"></a>
-<span class="sourceLineNo">1339</span>   */<a name="line.1339"></a>
-<span class="sourceLineNo">1340</span>  private int getMaxRegionsInTransition() {<a name="line.1340"></a>
-<span class="sourceLineNo">1341</span>    int numRegions = this.assignmentManager.getRegionStates().getRegionAssignments().size();<a name="line.1341"></a>
-<span class="sourceLineNo">1342</span>    return Math.max((int) Math.floor(numRegions * this.maxRitPercent), 1);<a name="line.1342"></a>
-<span class="sourceLineNo">1343</span>  }<a name="line.1343"></a>
-<span class="sourceLineNo">1344</span><a name="line.1344"></a>
-<span class="sourceLineNo">1345</span>  /**<a name="line.1345"></a>
-<span class="sourceLineNo">1346</span>   * It first sleep to the next balance plan start time. Meanwhile, throttling by the max<a name="line.1346"></a>
-<span class="sourceLineNo">1347</span>   * number regions in transition to protect availability.<a name="line.1347"></a>
-<span class="sourceLineNo">1348</span>   * @param nextBalanceStartTime The next balance plan start time<a name="line.1348"></a>
-<span class="sourceLineNo">1349</span>   * @param maxRegionsInTransition max number of regions in transition<a name="line.1349"></a>
-<span class="sourceLineNo">1350</span>   * @param cutoffTime when to exit balancer<a name="line.1350"></a>
-<span class="sourceLineNo">1351</span>   */<a name="line.1351"></a>
-<span class="sourceLineNo">1352</span>  private void balanceThrottling(long nextBalanceStartTime, int maxRegionsInTransition,<a name="line.1352"></a>
-<span class="sourceLineNo">1353</span>      long cutoffTime) {<a name="line.1353"></a>
-<span class="sourceLineNo">1354</span>    boolean interrupted = false;<a name="line.1354"></a>
+<span class="sourceLineNo">1324</span>    // The call could be from the local regionserver,<a name="line.1324"></a>
+<span class="sourceLineNo">1325</span>    // in which case, there is no remote address.<a name="line.1325"></a>
+<span class="sourceLineNo">1326</span>    if (ia == null &amp;&amp; serverStartCode == startcode) {<a name="line.1326"></a>
+<span class="sourceLineNo">1327</span>      InetSocketAddress isa = rpcServices.getSocketAddress();<a name="line.1327"></a>
+<span class="sourceLineNo">1328</span>      if (isa != null &amp;&amp; isa.getPort() == port) {<a name="line.1328"></a>
+<span class="sourceLineNo">1329</span>        ia = isa.getAddress();<a name="line.1329"></a>
+<span class="sourceLineNo">1330</span>      }<a name="line.1330"></a>
+<span class="sourceLineNo">1331</span>    }<a name="line.1331"></a>
+<span class="sourceLineNo">1332</span>    return ia;<a name="line.1332"></a>
+<span class="sourceLineNo">1333</span>  }<a name="line.1333"></a>
+<span class="sourceLineNo">1334</span><a name="line.1334"></a>
+<span class="sourceLineNo">1335</span>  /**<a name="line.1335"></a>
+<span class="sourceLineNo">1336</span>   * @return Maximum time we should run balancer for<a name="line.1336"></a>
+<span class="sourceLineNo">1337</span>   */<a name="line.1337"></a>
+<span class="sourceLineNo">1338</span>  private int getMaxBalancingTime() {<a name="line.1338"></a>
+<span class="sourceLineNo">1339</span>    int maxBalancingTime = getConfiguration().getInt(HConstants.HBASE_BALANCER_MAX_BALANCING, -1);<a name="line.1339"></a>
+<span class="sourceLineNo">1340</span>    if (maxBalancingTime == -1) {<a name="line.1340"></a>
+<span class="sourceLineNo">1341</span>      // if max balancing time isn't set, defaulting it to period time<a name="line.1341"></a>
+<span class="sourceLineNo">1342</span>      maxBalancingTime = getConfiguration().getInt(HConstants.HBASE_BALANCER_PERIOD,<a name="line.1342"></a>
+<span class="sourceLineNo">1343</span>        HConstants.DEFAULT_HBASE_BALANCER_PERIOD);<a name="line.1343"></a>
+<span class="sourceLineNo">1344</span>    }<a name="line.1344"></a>
+<span class="sourceLineNo">1345</span>    return maxBalancingTime;<a name="line.1345"></a>
+<span class="sourceLineNo">1346</span>  }<a name="line.1346"></a>
+<span class="sourceLineNo">1347</span><a name="line.1347"></a>
+<span class="sourceLineNo">1348</span>  /**<a name="line.1348"></a>
+<span class="sourceLineNo">1349</span>   * @return Maximum number of regions in transition<a name="line.1349"></a>
+<span class="sourceLineNo">1350</span>   */<a name="line.1350"></a>
+<span class="sourceLineNo">1351</span>  private int getMaxRegionsInTransition() {<a name="line.1351"></a>
+<span class="sourceLineNo">1352</span>    int numRegions = this.assignmentManager.getRegionStates().getRegionAssignments().size();<a name="line.1352"></a>
+<span class="sourceLineNo">1353</span>    return Math.max((int) Math.floor(numRegions * this.maxRitPercent), 1);<a name="line.1353"></a>
+<span class="sourceLineNo">1354</span>  }<a name="line.1354"></a>
 <span class="sourceLineNo">1355</span><a name="line.1355"></a>
-<span class="sourceLineNo">1356</span>    // Sleep to next balance plan start time<a name="line.1356"></a>
-<span class="sourceLineNo">1357</span>    // But if there are zero regions in transition, it can skip sleep to speed up.<a name="line.1357"></a>
-<span class="sourceLineNo">1358</span>    while (!interrupted &amp;&amp; System.currentTimeMillis() &lt; nextBalanceStartTime<a name="line.1358"></a>
-<span class="sourceLineNo">1359</span>        &amp;&amp; this.assignmentManager.getRegionStates().hasRegionsInTransition()) {<a name="line.1359"></a>
-<span class="sourceLineNo">1360</span>      try {<a name="line.1360"></a>
-<span class="sourceLineNo">1361</span>        Thread.sleep(100);<a name="line.1361"></a>
-<span class="sourceLineNo">1362</span>      } catch (InterruptedException ie) {<a name="line.1362"></a>
-<span class="sourceLineNo">1363</span>        interrupted = true;<a name="line.1363"></a>
-<span class="sourceLineNo">1364</span>      }<a name="line.1364"></a>
-<span class="sourceLineNo">1365</span>    }<a name="line.1365"></a>
+<span class="sourceLineNo">1356</span>  /**<a name="line.1356"></a>
+<span class="sourceLineNo">1357</span>   * It first sleep to the next balance plan start time. Meanwhile, throttling by the max<a name="line.1357"></a>
+<span class="sourceLineNo">1358</span>   * number regions in transition to protect availability.<a name="line.1358"></a>
+<span class="sourceLineNo">1359</span>   * @param nextBalanceStartTime The next balance plan start time<a name="line.1359"></a>
+<span class="sourceLineNo">1360</span>   * @param maxRegionsInTransition max number of regions in transition<a name="line.1360"></a>
+<span class="sourceLineNo">1361</span>   * @param cutoffTime when to exit balancer<a name="line.1361"></a>
+<span class="sourceLineNo">1362</span>   */<a name="line.1362"></a>
+<span class="sourceLineNo">1363</span>  private void balanceThrottling(long nextBalanceStartTime, int maxRegionsInTransition,<a name="line.1363"></a>
+<span class="sourceLineNo">1364</span>      long cutoffTime) {<a name="line.1364"></a>
+<span class="sourceLineNo">1365</span>    boolean interrupted = false;<a name="line.1365"></a>
 <span class="sourceLineNo">1366</span><a name="line.1366"></a>
-<span class="sourceLineNo">1367</span>    // Throttling by max number regions in transition<a name="line.1367"></a>
-<span class="sourceLineNo">1368</span>    while (!interrupted<a name="line.1368"></a>
-<span class="sourceLineNo">1369</span>        &amp;&amp; maxRegionsInTransition &gt; 0<a name="line.1369"></a>
-<span class="sourceLineNo">1370</span>        &amp;&amp; this.assignmentManager.getRegionStates().getRegionsInTransitionCount()<a name="line.1370"></a>
-<span class="sourceLineNo">1371</span>        &gt;= maxRegionsInTransition &amp;&amp; System.currentTimeMillis() &lt;= cutoffTime) {<a name="line.1371"></a>
-<span class="sourceLineNo">1372</span>      try {<a name="line.1372"></a>
-<span class="sourceLineNo">1373</span>        // sleep if the number of regions in transition exceeds the limit<a name="line.1373"></a>
-<span class="sourceLineNo">1374</span>        Thread.sleep(100);<a name="line.1374"></a>
-<span class="sourceLineNo">1375</span>      } catch (InterruptedException ie) {<a name="line.1375"></a>
-<span class="sourceLineNo">1376</span>        interrupted = true;<a name="line.1376"></a>
-<span class="sourceLineNo">1377</span>      }<a name="line.1377"></a>
-<span class="sourceLineNo">1378</span>    }<a name="line.1378"></a>
-<span class="sourceLineNo">1379</span><a name="line.1379"></a>
-<span class="sourceLineNo">1380</span>    if (interrupted) Thread.currentThread().interrupt();<a name="line.1380"></a>
-<span class="sourceLineNo">1381</span>  }<a name="line.1381"></a>
-<span class="sourceLineNo">1382</span><a name="line.1382"></a>
-<span class="sourceLineNo">1383</span>  public boolean balance() throws IOException {<a name="line.1383"></a>
-<span class="sourceLineNo">1384</span>    return balance(false);<a name="line.1384"></a>
-<span class="sourceLineNo">1385</span>  }<a name="line.1385"></a>
-<span class="sourceLineNo">1386</span><a name="line.1386"></a>
-<span class="sourceLineNo">1387</span>  public boolean balance(boolean force) throws IOException {<a name="line.1387"></a>
-<span class="sourceLineNo">1388</span>    // if master not initialized, don't run balancer.<a name="line.1388"></a>
-<span class="sourceLineNo">1389</span>    if (!isInitialized()) {<a name="line.1389"></a>
-<span class="sourceLineNo">1390</span>      LOG.debug("Master has not been initialized, don't run balancer.");<a name="line.1390"></a>
-<span class="sourceLineNo">1391</span>      return false;<a name="line.1391"></a>
-<span class="sourceLineNo">1392</span>    }<a name="line.1392"></a>
+<span class="sourceLineNo">1367</span>    // Sleep to next balance plan start time<a name="line.1367"></a>
+<span class="sourceLineNo">1368</span>    // But if there are zero regions in transition, it can skip sleep to speed up.<a name="line.1368"></a>
+<span class="sourceLineNo">1369</span>    while (!interrupted &amp;&amp; System.currentTimeMillis() &lt; nextBalanceStartTime<a name="line.1369"></a>
+<span class="sourceLineNo">1370</span>        &amp;&amp; this.assignmentManager.getRegionStates().hasRegionsInTransition()) {<a name="line.1370"></a>
+<span class="sourceLineNo">1371</span>      try {<a name="line.1371"></a>
+<span class="sourceLineNo">1372</span>        Thread.sleep(100);<a name="line.1372"></a>
+<span class="sourceLineNo">1373</span>      } catch (InterruptedException ie) {<a name="line.1373"></a>
+<span class="sourceLineNo">1374</span>        interrupted = true;<a name="line.1374"></a>
+<span class="sourceLineNo">1375</span>      }<a name="line.1375"></a>
+<span class="sourceLineNo">1376</span>    }<a name="line.1376"></a>
+<span class="sourceLineNo">1377</span><a name="line.1377"></a>
+<span class="sourceLineNo">1378</span>    // Throttling by max number regions in transition<a name="line.1378"></a>
+<span class="sourceLineNo">1379</span>    while (!interrupted<a name="line.1379"></a>
+<span class="sourceLineNo">1380</span>        &amp;&amp; maxRegionsInTransition &gt; 0<a name="line.1380"></a>
+<span class="sourceLineNo">1381</span>        &amp;&amp; this.assignmentManager.getRegionStates().getRegionsInTransitionCount()<a name="line.1381"></a>
+<span class="sourceLineNo">1382</span>        &gt;= maxRegionsInTransition &amp;&amp; System.currentTimeMillis() &lt;= cutoffTime) {<a name="line.1382"></a>
+<span class="sourceLineNo">1383</span>      try {<a name="line.1383"></a>
+<span class="sourceLineNo">1384</span>        // sleep if the number of regions in transition exceeds the limit<a name="line.1384"></a>
+<span class="sourceLineNo">1385</span>        Thread.sleep(100);<a name="line.1385"></a>
+<span class="sourceLineNo">1386</span>      } catch (InterruptedException ie) {<a name="line.1386"></a>
+<span class="sourceLineNo">1387</span>        interrupted = true;<a name="line.1387"></a>
+<span class="sourceLineNo">1388</span>      }<a name="line.1388"></a>
+<span class="sourceLineNo">1389</span>    }<a name="line.1389"></a>
+<span class="sourceLineNo">1390</span><a name="line.1390"></a>
+<span class="sourceLineNo">1391</span>    if (interrupted) Thread.currentThread().interrupt();<a name="line.1391"></a>
+<span class="sourceLineNo">1392</span>  }<a name="line.1392"></a>
 <span class="sourceLineNo">1393</span><a name="line.1393"></a>
-<span class="sourceLineNo">1394</span>    if (isInMaintenanceMode()) {<a name="line.1394"></a>
-<span class="sourceLineNo">1395</span>      LOG.info("Master is in maintenanceMode mode, don't run balancer.");<a name="line.1395"></a>
-<span class="sourceLineNo">1396</span>      return false;<a name="line.1396"></a>
-<span class="sourceLineNo">1397</span>    }<a name="line.1397"></a>
-<span class="sourceLineNo">1398</span><a name="line.1398"></a>
-<span class="sourceLineNo">1399</span>    int maxRegionsInTransition = getMaxRegionsInTransition();<a name="line.1399"></a>
-<span class="sourceLineNo">1400</span>    synchronized (this.balancer) {<a name="line.1400"></a>
-<span class="sourceLineNo">1401</span>      // If balance not true, don't run balancer.<a name="line.1401"></a>
-<span class="sourceLineNo">1402</span>      if (!this.loadBalancerTracker.isBalancerOn()) return false;<a name="line.1402"></a>
-<span class="sourceLineNo">1403</span>        // Only allow one balance run at at time.<a name="line.1403"></a>
-<span class="sourceLineNo">1404</span>      if (this.assignmentManager.hasRegionsInTransition()) {<a name="line.1404"></a>
-<span class="sourceLineNo">1405</span>        List&lt;RegionStateNode&gt; regionsInTransition = assignmentManager.getRegionsInTransition();<a name="line.1405"></a>
-<span class="sourceLineNo">1406</span>        // if hbase:meta region is in transition, result of assignment cannot be recorded<a name="line.1406"></a>
-<span class="sourceLineNo">1407</span>        // ignore the force flag in that case<a name="line.1407"></a>
-<span class="sourceLineNo">1408</span>        boolean metaInTransition = assignmentManager.isMetaRegionInTransition();<a name="line.1408"></a>
-<span class="sourceLineNo">1409</span>        String prefix = force &amp;&amp; !metaInTransition ? "R" : "Not r";<a name="line.1409"></a>
-<span class="sourceLineNo">1410</span>        List&lt;RegionStateNode&gt; toPrint = regionsInTransition;<a name="line.1410"></a>
-<span class="sourceLineNo">1411</span>        int max = 5;<a name="line.1411"></a>
-<span class="sourceLineNo">1412</span>        boolean truncated = false;<a name="line.1412"></a>
-<span class="sourceLineNo">1413</span>        if (regionsInTransition.size() &gt; max) {<a name="line.1413"></a>
-<span class="sourceLineNo">1414</span>          toPrint = regionsInTransition.subList(0, max);<a name="line.1414"></a>
-<span class="sourceLineNo">1415</span>          truncated = true;<a name="line.1415"></a>
-<span class="sourceLineNo">1416</span>        }<a name="line.1416"></a>
-<span class="sourceLineNo">1417</span>        LOG.info(prefix + "unning balancer because " + regionsInTransition.size() +<a name="line.1417"></a>
-<span class="sourceLineNo">1418</span>          " region(s) in transition: " + toPrint + (truncated? "(truncated list)": ""));<a name="line.1418"></a>
-<span class="sourceLineNo">1419</span>        if (!force || metaInTransition) return false;<a name="line.1419"></a>
-<span class="sourceLineNo">1420</span>      }<a name="line.1420"></a>
-<span class="sourceLineNo">1421</span>      if (this.serverManager.areDeadServersInProgress()) {<a name="line.1421"></a>
-<span class="sourceLineNo">1422</span>        LOG.info("Not running balancer because processing dead regionserver(s): " +<a name="line.1422"></a>
-<span class="sourceLineNo">1423</span>          this.serverManager.getDeadServers());<a name="line.1423"></a>
-<span class="sourceLineNo">1424</span>        return false;<a name="line.1424"></a>
-<span class="sourceLineNo">1425</span>      }<a name="line.1425"></a>
-<span class="sourceLineNo">1426</span><a name="line.1426"></a>
-<span class="sourceLineNo">1427</span>      if (this.cpHost != null) {<a name="line.1427"></a>
-<span class="sourceLineNo">1428</span>        try {<a name="line.1428"></a>
-<span class="sourceLineNo">1429</span>          if (this.cpHost.preBalance()) {<a name="line.1429"></a>
-<span class="sourceLineNo">1430</span>            LOG.debug("Coprocessor bypassing balancer request");<a name="line.1430"></a>
-<span class="sourceLineNo">1431</span>            return false;<a name="line.1431"></a>
-<span class="sourceLineNo">1432</span>          }<a name="line.1432"></a>
-<span class="sourceLineNo">1433</span>        } catch (IOException ioe) {<a name="line.1433"></a>
-<span class="sourceLineNo">1434</span>          LOG.error("Error invoking master coprocessor preBalance()", ioe);<a name="line.1434"></a>
-<span class="sourceLineNo">1435</span>          return false;<a name="line.1435"></a>
-<span class="sourceLineNo">1436</span>        }<a name="line.1436"></a>
-<span class="sourceLineNo">1437</span>      }<a name="line.1437"></a>
-<span class="sourceLineNo">1438</span><a name="line.1438"></a>
-<span class="sourceLineNo">1439</span>      boolean isByTable = getConfiguration().getBoolean("hbase.master.loadbalance.bytable", false);<a name="line.1439"></a>
-<span class="sourceLineNo">1440</span>      Map&lt;TableName, Map&lt;ServerName, List&lt;RegionInfo&gt;&gt;&gt; assignmentsByTable =<a name="line.1440"></a>
-<span class="sourceLineNo">1441</span>        this.assignmentManager.getRegionStates().getAssignmentsByTable(!isByTable);<a name="line.1441"></a>
-<span class="sourceLineNo">1442</span><a name="line.1442"></a>
-<span class="sourceLineNo">1443</span>      List&lt;RegionPlan&gt; plans = new ArrayList&lt;&gt;();<a name="line.1443"></a>
-<span class="sourceLineNo">1444</span><a name="line.1444"></a>
-<span class="sourceLineNo">1445</span>      //Give the balancer the current cluster state.<a name="line.1445"></a>
-<span class="sourceLineNo">1446</span>      this.balancer.setClusterMetrics(getClusterMetricsWithoutCoprocessor());<a name="line.1446"></a>
-<span class="sourceLineNo">1447</span>      this.balancer.setClusterLoad(assignmentsByTable);<a name="line.1447"></a>
-<span class="sourceLineNo">1448</span><a name="line.1448"></a>
-<span class="sourceLineNo">1449</span>      for (Map&lt;ServerName, List&lt;RegionInfo&gt;&gt; serverMap : assignmentsByTable.values()) {<a name="line.1449"></a>
-<span class="sourceLineNo">1450</span>        serverMap.keySet().removeAll(this.serverManager.getDrainingServersList());<a name="line.1450"></a>
-<span class="sourceLineNo">1451</span>      }<a name="line.1451"></a>
-<span class="sourceLineNo">1452</span>      for (Entry&lt;TableName, Map&lt;ServerName, List&lt;RegionInfo&gt;&gt;&gt; e : assignmentsByTable.entrySet()) {<a name="line.1452"></a>
-<span class="sourceLineNo">1453</span>        List&lt;RegionPlan&gt; partialPlans = this.balancer.balanceCluster(e.getKey(), e.getValue());<a name="line.1453"></a>
-<span class="sourceLineNo">1454</span>        if (partialPlans != null) plans.addAll(partialPlans);<a name="line.1454"></a>
-<span class="sourceLineNo">1455</span>      }<a name="line.1455"></a>
-<span class="sourceLineNo">1456</span><a name="line.1456"></a>
-<span class="sourceLineNo">1457</span>      long balanceStartTime = System.currentTimeMillis();<a name="line.1457"></a>
-<span class="sourceLineNo">1458</span>      long cutoffTime = balanceStartTime + this.maxBlancingTime;<a name="line.1458"></a>
-<span class="sourceLineNo">1459</span>      int rpCount = 0;  // number of RegionPlans balanced so far<a name="line.1459"></a>
-<span class="sourceLineNo">1460</span>      if (plans != null &amp;&amp; !plans.isEmpty()) {<a name="line.1460"></a>
-<span class="sourceLineNo">1461</span>        int balanceInterval = this.maxBlancingTime / plans.size();<a name="line.1461"></a>
-<span class="sourceLineNo">1462</span>        LOG.info("Balancer plans size is " + plans.size() + ", the balance interval is "<a name="line.1462"></a>
-<span class="sourceLineNo">1463</span>            + balanceInterval + " ms, and the max number regions in transition is "<a name="line.1463"></a>
-<span class="sourceLineNo">1464</span>            + maxRegionsInTransition);<a name="line.1464"></a>
-<span class="sourceLineNo">1465</span><a name="line.1465"></a>
-<span class="sourceLineNo">1466</span>        for (RegionPlan plan: plans) {<a name="line.1466"></a>
-<span class="sourceLineNo">1467</span>          LOG.info("balance " + plan);<a name="line.1467"></a>
-<span class="sourceLineNo">1468</span>          //TODO: bulk assign<a name="line.1468"></a>
-<span class="sourceLineNo">1469</span>          this.assignmentManager.moveAsync(plan);<a name="line.1469"></a>
-<span class="sourceLineNo">1470</span>          rpCount++;<a name="line.1470"></a>
-<span class="sourceLineNo">1471</span><a name="line.1471"></a>
-<span class="sourceLineNo">1472</span>          balanceThrottling(balanceStartTime + rpCount * balanceInterval, maxRegionsInTransition,<a name="line.1472"></a>
-<span class="sourceLineNo">1473</span>            cutoffTime);<a name="line.1473"></a>
-<span class="sourceLineNo">1474</span><a name="line.1474"></a>
-<span class="sourceLineNo">1475</span>          // if performing next balance exceeds cutoff time, exit the loop<a name="line.1475"></a>
-<span class="sourceLineNo">1476</span>          if (rpCount &lt; plans.size() &amp;&amp; System.currentTimeMillis() &gt; cutoffTime) {<a name="line.1476"></a>
-<span class="sourceLineNo">1477</span>            // TODO: After balance, there should not be a cutoff time (keeping it as<a name="line.1477"></a>
-<span class="sourceLineNo">1478</span>            // a security net for now)<a name="line.1478"></a>
-<span class="sourceLineNo">1479</span>            LOG.debug("No more balancing till next balance run; maxBalanceTime="<a name="line.1479"></a>
-<span class="sourceLineNo">1480</span>                + this.maxBlancingTime);<a name="line.1480"></a>
-<span class="sourceLineNo">1481</span>            break;<a name="line.1481"></a>
-<span class="sourceLineNo">1482</span>          }<a name="line.1482"></a>
-<span class="sourceLineNo">1483</span>        }<a name="line.1483"></a>
-<span class="sourceLineNo">1484</span>      }<a name="line.1484"></a>
+<span class="sourceLineNo">1394</span>  public boolean balance() throws IOException {<a name="line.1394"></a>
+<span class="sourceLineNo">1395</span>    return balance(false);<a name="line.1395"></a>
+<span class="sourceLineNo">1396</span>  }<a name="line.1396"></a>
+<span class="sourceLineNo">1397</span><a name="line.1397"></a>
+<span class="sourceLineNo">1398</span>  public boolean balance(boolean force) throws IOException {<a name="line.1398"></a>
+<span class="sourceLineNo">1399</span>    // if master not initialized, don't run balancer.<a name="line.1399"></a>
+<span class="sourceLineNo">1400</span>    if (!isInitialized()) {<a name="line.1400"></a>
+<span class="sourceLineNo">1401</span>      LOG.debug("Master has not been initialized, don't run balancer.");<a name="line.1401"></a>
+<span class="sourceLineNo">1402</span>      return false;<a name="line.1402"></a>
+<span class="sourceLineNo">1403</span>    }<a name="line.1403"></a>
+<span class="sourceLineNo">1404</span><a name="line.1404"></a>
+<span class="sourceLineNo">1405</span>    if (isInMaintenanceMode()) {<a name="line.1405"></a>
+<span class="sourceLineNo">1406</span>      LOG.info("Master is in maintenanceMode mode, don't run balancer.");<a name="line.1406"></a>
+<span class="sourceLineNo">1407</span>      return false;<a name="line.1407"></a>
+<span class="sourceLineNo">1408</span>    }<a name="line.1408"></a>
+<span class="sourceLineNo">1409</span><a name="line.1409"></a>
+<span class="sourceLineNo">1410</span>    int maxRegionsInTransition = getMaxRegionsInTransition();<a name="line.1410"></a>
+<span class="sourceLineNo">1411</

<TRUNCATED>

Mime
View raw message