hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From git-site-r...@apache.org
Subject [07/16] hbase-site git commit: Published site at .
Date Sun, 21 Jan 2018 15:31:24 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/fa7f84a0/devapidocs/src-html/org/apache/hadoop/hbase/master/HMaster.RedirectServlet.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/master/HMaster.RedirectServlet.html b/devapidocs/src-html/org/apache/hadoop/hbase/master/HMaster.RedirectServlet.html
index 7f494de..708f214 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/master/HMaster.RedirectServlet.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/master/HMaster.RedirectServlet.html
@@ -2700,856 +2700,858 @@
 <span class="sourceLineNo">2692</span><a name="line.2692"></a>
 <span class="sourceLineNo">2693</span>  @Override<a name="line.2693"></a>
 <span class="sourceLineNo">2694</span>  public void stop(String msg) {<a name="line.2694"></a>
-<span class="sourceLineNo">2695</span>    super.stop(msg);<a name="line.2695"></a>
-<span class="sourceLineNo">2696</span>    if (this.activeMasterManager != null) {<a name="line.2696"></a>
-<span class="sourceLineNo">2697</span>      this.activeMasterManager.stop();<a name="line.2697"></a>
-<span class="sourceLineNo">2698</span>    }<a name="line.2698"></a>
-<span class="sourceLineNo">2699</span>  }<a name="line.2699"></a>
-<span class="sourceLineNo">2700</span><a name="line.2700"></a>
-<span class="sourceLineNo">2701</span>  void checkServiceStarted() throws ServerNotRunningYetException {<a name="line.2701"></a>
-<span class="sourceLineNo">2702</span>    if (!serviceStarted) {<a name="line.2702"></a>
-<span class="sourceLineNo">2703</span>      throw new ServerNotRunningYetException("Server is not running yet");<a name="line.2703"></a>
-<span class="sourceLineNo">2704</span>    }<a name="line.2704"></a>
-<span class="sourceLineNo">2705</span>  }<a name="line.2705"></a>
-<span class="sourceLineNo">2706</span><a name="line.2706"></a>
-<span class="sourceLineNo">2707</span>  void checkInitialized()<a name="line.2707"></a>
-<span class="sourceLineNo">2708</span>      throws PleaseHoldException, ServerNotRunningYetException, MasterNotRunningException {<a name="line.2708"></a>
-<span class="sourceLineNo">2709</span>    checkServiceStarted();<a name="line.2709"></a>
-<span class="sourceLineNo">2710</span>    if (!isInitialized()) throw new PleaseHoldException("Master is initializing");<a name="line.2710"></a>
-<span class="sourceLineNo">2711</span>    if (isStopped()) throw new MasterNotRunningException();<a name="line.2711"></a>
-<span class="sourceLineNo">2712</span>  }<a name="line.2712"></a>
-<span class="sourceLineNo">2713</span><a name="line.2713"></a>
-<span class="sourceLineNo">2714</span>  /**<a name="line.2714"></a>
-<span class="sourceLineNo">2715</span>   * Report whether this master is currently the active master or not.<a name="line.2715"></a>
-<span class="sourceLineNo">2716</span>   * If not active master, we are parked on ZK waiting to become active.<a name="line.2716"></a>
-<span class="sourceLineNo">2717</span>   *<a name="line.2717"></a>
-<span class="sourceLineNo">2718</span>   * This method is used for testing.<a name="line.2718"></a>
+<span class="sourceLineNo">2695</span>    if (!isStopped()) {<a name="line.2695"></a>
+<span class="sourceLineNo">2696</span>      super.stop(msg);<a name="line.2696"></a>
+<span class="sourceLineNo">2697</span>      if (this.activeMasterManager != null) {<a name="line.2697"></a>
+<span class="sourceLineNo">2698</span>        this.activeMasterManager.stop();<a name="line.2698"></a>
+<span class="sourceLineNo">2699</span>      }<a name="line.2699"></a>
+<span class="sourceLineNo">2700</span>    }<a name="line.2700"></a>
+<span class="sourceLineNo">2701</span>  }<a name="line.2701"></a>
+<span class="sourceLineNo">2702</span><a name="line.2702"></a>
+<span class="sourceLineNo">2703</span>  void checkServiceStarted() throws ServerNotRunningYetException {<a name="line.2703"></a>
+<span class="sourceLineNo">2704</span>    if (!serviceStarted) {<a name="line.2704"></a>
+<span class="sourceLineNo">2705</span>      throw new ServerNotRunningYetException("Server is not running yet");<a name="line.2705"></a>
+<span class="sourceLineNo">2706</span>    }<a name="line.2706"></a>
+<span class="sourceLineNo">2707</span>  }<a name="line.2707"></a>
+<span class="sourceLineNo">2708</span><a name="line.2708"></a>
+<span class="sourceLineNo">2709</span>  void checkInitialized()<a name="line.2709"></a>
+<span class="sourceLineNo">2710</span>      throws PleaseHoldException, ServerNotRunningYetException, MasterNotRunningException {<a name="line.2710"></a>
+<span class="sourceLineNo">2711</span>    checkServiceStarted();<a name="line.2711"></a>
+<span class="sourceLineNo">2712</span>    if (!isInitialized()) throw new PleaseHoldException("Master is initializing");<a name="line.2712"></a>
+<span class="sourceLineNo">2713</span>    if (isStopped()) throw new MasterNotRunningException();<a name="line.2713"></a>
+<span class="sourceLineNo">2714</span>  }<a name="line.2714"></a>
+<span class="sourceLineNo">2715</span><a name="line.2715"></a>
+<span class="sourceLineNo">2716</span>  /**<a name="line.2716"></a>
+<span class="sourceLineNo">2717</span>   * Report whether this master is currently the active master or not.<a name="line.2717"></a>
+<span class="sourceLineNo">2718</span>   * If not active master, we are parked on ZK waiting to become active.<a name="line.2718"></a>
 <span class="sourceLineNo">2719</span>   *<a name="line.2719"></a>
-<span class="sourceLineNo">2720</span>   * @return true if active master, false if not.<a name="line.2720"></a>
-<span class="sourceLineNo">2721</span>   */<a name="line.2721"></a>
-<span class="sourceLineNo">2722</span>  @Override<a name="line.2722"></a>
-<span class="sourceLineNo">2723</span>  public boolean isActiveMaster() {<a name="line.2723"></a>
-<span class="sourceLineNo">2724</span>    return activeMaster;<a name="line.2724"></a>
-<span class="sourceLineNo">2725</span>  }<a name="line.2725"></a>
-<span class="sourceLineNo">2726</span><a name="line.2726"></a>
-<span class="sourceLineNo">2727</span>  /**<a name="line.2727"></a>
-<span class="sourceLineNo">2728</span>   * Report whether this master has completed with its initialization and is<a name="line.2728"></a>
-<span class="sourceLineNo">2729</span>   * ready.  If ready, the master is also the active master.  A standby master<a name="line.2729"></a>
-<span class="sourceLineNo">2730</span>   * is never ready.<a name="line.2730"></a>
-<span class="sourceLineNo">2731</span>   *<a name="line.2731"></a>
-<span class="sourceLineNo">2732</span>   * This method is used for testing.<a name="line.2732"></a>
+<span class="sourceLineNo">2720</span>   * This method is used for testing.<a name="line.2720"></a>
+<span class="sourceLineNo">2721</span>   *<a name="line.2721"></a>
+<span class="sourceLineNo">2722</span>   * @return true if active master, false if not.<a name="line.2722"></a>
+<span class="sourceLineNo">2723</span>   */<a name="line.2723"></a>
+<span class="sourceLineNo">2724</span>  @Override<a name="line.2724"></a>
+<span class="sourceLineNo">2725</span>  public boolean isActiveMaster() {<a name="line.2725"></a>
+<span class="sourceLineNo">2726</span>    return activeMaster;<a name="line.2726"></a>
+<span class="sourceLineNo">2727</span>  }<a name="line.2727"></a>
+<span class="sourceLineNo">2728</span><a name="line.2728"></a>
+<span class="sourceLineNo">2729</span>  /**<a name="line.2729"></a>
+<span class="sourceLineNo">2730</span>   * Report whether this master has completed with its initialization and is<a name="line.2730"></a>
+<span class="sourceLineNo">2731</span>   * ready.  If ready, the master is also the active master.  A standby master<a name="line.2731"></a>
+<span class="sourceLineNo">2732</span>   * is never ready.<a name="line.2732"></a>
 <span class="sourceLineNo">2733</span>   *<a name="line.2733"></a>
-<span class="sourceLineNo">2734</span>   * @return true if master is ready to go, false if not.<a name="line.2734"></a>
-<span class="sourceLineNo">2735</span>   */<a name="line.2735"></a>
-<span class="sourceLineNo">2736</span>  @Override<a name="line.2736"></a>
-<span class="sourceLineNo">2737</span>  public boolean isInitialized() {<a name="line.2737"></a>
-<span class="sourceLineNo">2738</span>    return initialized.isReady();<a name="line.2738"></a>
-<span class="sourceLineNo">2739</span>  }<a name="line.2739"></a>
-<span class="sourceLineNo">2740</span><a name="line.2740"></a>
-<span class="sourceLineNo">2741</span>  /**<a name="line.2741"></a>
-<span class="sourceLineNo">2742</span>   * Report whether this master is in maintenance mode.<a name="line.2742"></a>
-<span class="sourceLineNo">2743</span>   *<a name="line.2743"></a>
-<span class="sourceLineNo">2744</span>   * @return true if master is in maintenanceMode<a name="line.2744"></a>
-<span class="sourceLineNo">2745</span>   */<a name="line.2745"></a>
-<span class="sourceLineNo">2746</span>  @Override<a name="line.2746"></a>
-<span class="sourceLineNo">2747</span>  public boolean isInMaintenanceMode() {<a name="line.2747"></a>
-<span class="sourceLineNo">2748</span>    return maintenanceModeTracker.isInMaintenanceMode();<a name="line.2748"></a>
-<span class="sourceLineNo">2749</span>  }<a name="line.2749"></a>
-<span class="sourceLineNo">2750</span><a name="line.2750"></a>
-<span class="sourceLineNo">2751</span>  @VisibleForTesting<a name="line.2751"></a>
-<span class="sourceLineNo">2752</span>  public void setInitialized(boolean isInitialized) {<a name="line.2752"></a>
-<span class="sourceLineNo">2753</span>    procedureExecutor.getEnvironment().setEventReady(initialized, isInitialized);<a name="line.2753"></a>
-<span class="sourceLineNo">2754</span>  }<a name="line.2754"></a>
-<span class="sourceLineNo">2755</span><a name="line.2755"></a>
-<span class="sourceLineNo">2756</span>  @Override<a name="line.2756"></a>
-<span class="sourceLineNo">2757</span>  public ProcedureEvent&lt;?&gt; getInitializedEvent() {<a name="line.2757"></a>
-<span class="sourceLineNo">2758</span>    return initialized;<a name="line.2758"></a>
-<span class="sourceLineNo">2759</span>  }<a name="line.2759"></a>
-<span class="sourceLineNo">2760</span><a name="line.2760"></a>
-<span class="sourceLineNo">2761</span>  /**<a name="line.2761"></a>
-<span class="sourceLineNo">2762</span>   * ServerCrashProcessingEnabled is set false before completing assignMeta to prevent processing<a name="line.2762"></a>
-<span class="sourceLineNo">2763</span>   * of crashed servers.<a name="line.2763"></a>
-<span class="sourceLineNo">2764</span>   * @return true if assignMeta has completed;<a name="line.2764"></a>
-<span class="sourceLineNo">2765</span>   */<a name="line.2765"></a>
-<span class="sourceLineNo">2766</span>  @Override<a name="line.2766"></a>
-<span class="sourceLineNo">2767</span>  public boolean isServerCrashProcessingEnabled() {<a name="line.2767"></a>
-<span class="sourceLineNo">2768</span>    return serverCrashProcessingEnabled.isReady();<a name="line.2768"></a>
-<span class="sourceLineNo">2769</span>  }<a name="line.2769"></a>
-<span class="sourceLineNo">2770</span><a name="line.2770"></a>
-<span class="sourceLineNo">2771</span>  @VisibleForTesting<a name="line.2771"></a>
-<span class="sourceLineNo">2772</span>  public void setServerCrashProcessingEnabled(final boolean b) {<a name="line.2772"></a>
-<span class="sourceLineNo">2773</span>    procedureExecutor.getEnvironment().setEventReady(serverCrashProcessingEnabled, b);<a name="line.2773"></a>
-<span class="sourceLineNo">2774</span>  }<a name="line.2774"></a>
-<span class="sourceLineNo">2775</span><a name="line.2775"></a>
-<span class="sourceLineNo">2776</span>  public ProcedureEvent&lt;?&gt; getServerCrashProcessingEnabledEvent() {<a name="line.2776"></a>
-<span class="sourceLineNo">2777</span>    return serverCrashProcessingEnabled;<a name="line.2777"></a>
-<span class="sourceLineNo">2778</span>  }<a name="line.2778"></a>
-<span class="sourceLineNo">2779</span><a name="line.2779"></a>
-<span class="sourceLineNo">2780</span>  /**<a name="line.2780"></a>
-<span class="sourceLineNo">2781</span>   * Compute the average load across all region servers.<a name="line.2781"></a>
-<span class="sourceLineNo">2782</span>   * Currently, this uses a very naive computation - just uses the number of<a name="line.2782"></a>
-<span class="sourceLineNo">2783</span>   * regions being served, ignoring stats about number of requests.<a name="line.2783"></a>
-<span class="sourceLineNo">2784</span>   * @return the average load<a name="line.2784"></a>
-<span class="sourceLineNo">2785</span>   */<a name="line.2785"></a>
-<span class="sourceLineNo">2786</span>  public double getAverageLoad() {<a name="line.2786"></a>
-<span class="sourceLineNo">2787</span>    if (this.assignmentManager == null) {<a name="line.2787"></a>
-<span class="sourceLineNo">2788</span>      return 0;<a name="line.2788"></a>
-<span class="sourceLineNo">2789</span>    }<a name="line.2789"></a>
-<span class="sourceLineNo">2790</span><a name="line.2790"></a>
-<span class="sourceLineNo">2791</span>    RegionStates regionStates = this.assignmentManager.getRegionStates();<a name="line.2791"></a>
-<span class="sourceLineNo">2792</span>    if (regionStates == null) {<a name="line.2792"></a>
-<span class="sourceLineNo">2793</span>      return 0;<a name="line.2793"></a>
-<span class="sourceLineNo">2794</span>    }<a name="line.2794"></a>
-<span class="sourceLineNo">2795</span>    return regionStates.getAverageLoad();<a name="line.2795"></a>
-<span class="sourceLineNo">2796</span>  }<a name="line.2796"></a>
-<span class="sourceLineNo">2797</span><a name="line.2797"></a>
-<span class="sourceLineNo">2798</span>  /*<a name="line.2798"></a>
-<span class="sourceLineNo">2799</span>   * @return the count of region split plans executed<a name="line.2799"></a>
-<span class="sourceLineNo">2800</span>   */<a name="line.2800"></a>
-<span class="sourceLineNo">2801</span>  public long getSplitPlanCount() {<a name="line.2801"></a>
-<span class="sourceLineNo">2802</span>    return splitPlanCount;<a name="line.2802"></a>
-<span class="sourceLineNo">2803</span>  }<a name="line.2803"></a>
-<span class="sourceLineNo">2804</span><a name="line.2804"></a>
-<span class="sourceLineNo">2805</span>  /*<a name="line.2805"></a>
-<span class="sourceLineNo">2806</span>   * @return the count of region merge plans executed<a name="line.2806"></a>
-<span class="sourceLineNo">2807</span>   */<a name="line.2807"></a>
-<span class="sourceLineNo">2808</span>  public long getMergePlanCount() {<a name="line.2808"></a>
-<span class="sourceLineNo">2809</span>    return mergePlanCount;<a name="line.2809"></a>
-<span class="sourceLineNo">2810</span>  }<a name="line.2810"></a>
-<span class="sourceLineNo">2811</span><a name="line.2811"></a>
-<span class="sourceLineNo">2812</span>  @Override<a name="line.2812"></a>
-<span class="sourceLineNo">2813</span>  public boolean registerService(Service instance) {<a name="line.2813"></a>
-<span class="sourceLineNo">2814</span>    /*<a name="line.2814"></a>
-<span class="sourceLineNo">2815</span>     * No stacking of instances is allowed for a single service name<a name="line.2815"></a>
-<span class="sourceLineNo">2816</span>     */<a name="line.2816"></a>
-<span class="sourceLineNo">2817</span>    Descriptors.ServiceDescriptor serviceDesc = instance.getDescriptorForType();<a name="line.2817"></a>
-<span class="sourceLineNo">2818</span>    String serviceName = CoprocessorRpcUtils.getServiceName(serviceDesc);<a name="line.2818"></a>
-<span class="sourceLineNo">2819</span>    if (coprocessorServiceHandlers.containsKey(serviceName)) {<a name="line.2819"></a>
-<span class="sourceLineNo">2820</span>      LOG.error("Coprocessor service "+serviceName+<a name="line.2820"></a>
-<span class="sourceLineNo">2821</span>          " already registered, rejecting request from "+instance<a name="line.2821"></a>
-<span class="sourceLineNo">2822</span>      );<a name="line.2822"></a>
-<span class="sourceLineNo">2823</span>      return false;<a name="line.2823"></a>
-<span class="sourceLineNo">2824</span>    }<a name="line.2824"></a>
-<span class="sourceLineNo">2825</span><a name="line.2825"></a>
-<span class="sourceLineNo">2826</span>    coprocessorServiceHandlers.put(serviceName, instance);<a name="line.2826"></a>
-<span class="sourceLineNo">2827</span>    if (LOG.isDebugEnabled()) {<a name="line.2827"></a>
-<span class="sourceLineNo">2828</span>      LOG.debug("Registered master coprocessor service: service="+serviceName);<a name="line.2828"></a>
-<span class="sourceLineNo">2829</span>    }<a name="line.2829"></a>
-<span class="sourceLineNo">2830</span>    return true;<a name="line.2830"></a>
-<span class="sourceLineNo">2831</span>  }<a name="line.2831"></a>
-<span class="sourceLineNo">2832</span><a name="line.2832"></a>
-<span class="sourceLineNo">2833</span>  /**<a name="line.2833"></a>
-<span class="sourceLineNo">2834</span>   * Utility for constructing an instance of the passed HMaster class.<a name="line.2834"></a>
-<span class="sourceLineNo">2835</span>   * @param masterClass<a name="line.2835"></a>
-<span class="sourceLineNo">2836</span>   * @return HMaster instance.<a name="line.2836"></a>
-<span class="sourceLineNo">2837</span>   */<a name="line.2837"></a>
-<span class="sourceLineNo">2838</span>  public static HMaster constructMaster(Class&lt;? extends HMaster&gt; masterClass,<a name="line.2838"></a>
-<span class="sourceLineNo">2839</span>      final Configuration conf)  {<a name="line.2839"></a>
-<span class="sourceLineNo">2840</span>    try {<a name="line.2840"></a>
-<span class="sourceLineNo">2841</span>      Constructor&lt;? extends HMaster&gt; c = masterClass.getConstructor(Configuration.class);<a name="line.2841"></a>
-<span class="sourceLineNo">2842</span>      return c.newInstance(conf);<a name="line.2842"></a>
-<span class="sourceLineNo">2843</span>    } catch(Exception e) {<a name="line.2843"></a>
-<span class="sourceLineNo">2844</span>      Throwable error = e;<a name="line.2844"></a>
-<span class="sourceLineNo">2845</span>      if (e instanceof InvocationTargetException &amp;&amp;<a name="line.2845"></a>
-<span class="sourceLineNo">2846</span>          ((InvocationTargetException)e).getTargetException() != null) {<a name="line.2846"></a>
-<span class="sourceLineNo">2847</span>        error = ((InvocationTargetException)e).getTargetException();<a name="line.2847"></a>
-<span class="sourceLineNo">2848</span>      }<a name="line.2848"></a>
-<span class="sourceLineNo">2849</span>      throw new RuntimeException("Failed construction of Master: " + masterClass.toString() + ". "<a name="line.2849"></a>
-<span class="sourceLineNo">2850</span>        , error);<a name="line.2850"></a>
-<span class="sourceLineNo">2851</span>    }<a name="line.2851"></a>
-<span class="sourceLineNo">2852</span>  }<a name="line.2852"></a>
-<span class="sourceLineNo">2853</span><a name="line.2853"></a>
-<span class="sourceLineNo">2854</span>  /**<a name="line.2854"></a>
-<span class="sourceLineNo">2855</span>   * @see org.apache.hadoop.hbase.master.HMasterCommandLine<a name="line.2855"></a>
-<span class="sourceLineNo">2856</span>   */<a name="line.2856"></a>
-<span class="sourceLineNo">2857</span>  public static void main(String [] args) {<a name="line.2857"></a>
-<span class="sourceLineNo">2858</span>    LOG.info("STARTING service " + HMaster.class.getSimpleName());<a name="line.2858"></a>
-<span class="sourceLineNo">2859</span>    VersionInfo.logVersion();<a name="line.2859"></a>
-<span class="sourceLineNo">2860</span>    new HMasterCommandLine(HMaster.class).doMain(args);<a name="line.2860"></a>
-<span class="sourceLineNo">2861</span>  }<a name="line.2861"></a>
-<span class="sourceLineNo">2862</span><a name="line.2862"></a>
-<span class="sourceLineNo">2863</span>  public HFileCleaner getHFileCleaner() {<a name="line.2863"></a>
-<span class="sourceLineNo">2864</span>    return this.hfileCleaner;<a name="line.2864"></a>
-<span class="sourceLineNo">2865</span>  }<a name="line.2865"></a>
-<span class="sourceLineNo">2866</span><a name="line.2866"></a>
-<span class="sourceLineNo">2867</span>  public LogCleaner getLogCleaner() {<a name="line.2867"></a>
-<span class="sourceLineNo">2868</span>    return this.logCleaner;<a name="line.2868"></a>
-<span class="sourceLineNo">2869</span>  }<a name="line.2869"></a>
-<span class="sourceLineNo">2870</span><a name="line.2870"></a>
-<span class="sourceLineNo">2871</span>  /**<a name="line.2871"></a>
-<span class="sourceLineNo">2872</span>   * @return the underlying snapshot manager<a name="line.2872"></a>
-<span class="sourceLineNo">2873</span>   */<a name="line.2873"></a>
-<span class="sourceLineNo">2874</span>  @Override<a name="line.2874"></a>
-<span class="sourceLineNo">2875</span>  public SnapshotManager getSnapshotManager() {<a name="line.2875"></a>
-<span class="sourceLineNo">2876</span>    return this.snapshotManager;<a name="line.2876"></a>
-<span class="sourceLineNo">2877</span>  }<a name="line.2877"></a>
-<span class="sourceLineNo">2878</span><a name="line.2878"></a>
-<span class="sourceLineNo">2879</span>  /**<a name="line.2879"></a>
-<span class="sourceLineNo">2880</span>   * @return the underlying MasterProcedureManagerHost<a name="line.2880"></a>
-<span class="sourceLineNo">2881</span>   */<a name="line.2881"></a>
-<span class="sourceLineNo">2882</span>  @Override<a name="line.2882"></a>
-<span class="sourceLineNo">2883</span>  public MasterProcedureManagerHost getMasterProcedureManagerHost() {<a name="line.2883"></a>
-<span class="sourceLineNo">2884</span>    return mpmHost;<a name="line.2884"></a>
-<span class="sourceLineNo">2885</span>  }<a name="line.2885"></a>
-<span class="sourceLineNo">2886</span><a name="line.2886"></a>
-<span class="sourceLineNo">2887</span>  @Override<a name="line.2887"></a>
-<span class="sourceLineNo">2888</span>  public ClusterSchema getClusterSchema() {<a name="line.2888"></a>
-<span class="sourceLineNo">2889</span>    return this.clusterSchemaService;<a name="line.2889"></a>
-<span class="sourceLineNo">2890</span>  }<a name="line.2890"></a>
-<span class="sourceLineNo">2891</span><a name="line.2891"></a>
-<span class="sourceLineNo">2892</span>  /**<a name="line.2892"></a>
-<span class="sourceLineNo">2893</span>   * Create a new Namespace.<a name="line.2893"></a>
-<span class="sourceLineNo">2894</span>   * @param namespaceDescriptor descriptor for new Namespace<a name="line.2894"></a>
-<span class="sourceLineNo">2895</span>   * @param nonceGroup Identifier for the source of the request, a client or process.<a name="line.2895"></a>
-<span class="sourceLineNo">2896</span>   * @param nonce A unique identifier for this operation from the client or process identified by<a name="line.2896"></a>
-<span class="sourceLineNo">2897</span>   * &lt;code&gt;nonceGroup&lt;/code&gt; (the source must ensure each operation gets a unique id).<a name="line.2897"></a>
-<span class="sourceLineNo">2898</span>   * @return procedure id<a name="line.2898"></a>
-<span class="sourceLineNo">2899</span>   */<a name="line.2899"></a>
-<span class="sourceLineNo">2900</span>  long createNamespace(final NamespaceDescriptor namespaceDescriptor, final long nonceGroup,<a name="line.2900"></a>
-<span class="sourceLineNo">2901</span>      final long nonce) throws IOException {<a name="line.2901"></a>
-<span class="sourceLineNo">2902</span>    checkInitialized();<a name="line.2902"></a>
-<span class="sourceLineNo">2903</span><a name="line.2903"></a>
-<span class="sourceLineNo">2904</span>    TableName.isLegalNamespaceName(Bytes.toBytes(namespaceDescriptor.getName()));<a name="line.2904"></a>
+<span class="sourceLineNo">2734</span>   * This method is used for testing.<a name="line.2734"></a>
+<span class="sourceLineNo">2735</span>   *<a name="line.2735"></a>
+<span class="sourceLineNo">2736</span>   * @return true if master is ready to go, false if not.<a name="line.2736"></a>
+<span class="sourceLineNo">2737</span>   */<a name="line.2737"></a>
+<span class="sourceLineNo">2738</span>  @Override<a name="line.2738"></a>
+<span class="sourceLineNo">2739</span>  public boolean isInitialized() {<a name="line.2739"></a>
+<span class="sourceLineNo">2740</span>    return initialized.isReady();<a name="line.2740"></a>
+<span class="sourceLineNo">2741</span>  }<a name="line.2741"></a>
+<span class="sourceLineNo">2742</span><a name="line.2742"></a>
+<span class="sourceLineNo">2743</span>  /**<a name="line.2743"></a>
+<span class="sourceLineNo">2744</span>   * Report whether this master is in maintenance mode.<a name="line.2744"></a>
+<span class="sourceLineNo">2745</span>   *<a name="line.2745"></a>
+<span class="sourceLineNo">2746</span>   * @return true if master is in maintenanceMode<a name="line.2746"></a>
+<span class="sourceLineNo">2747</span>   */<a name="line.2747"></a>
+<span class="sourceLineNo">2748</span>  @Override<a name="line.2748"></a>
+<span class="sourceLineNo">2749</span>  public boolean isInMaintenanceMode() {<a name="line.2749"></a>
+<span class="sourceLineNo">2750</span>    return maintenanceModeTracker.isInMaintenanceMode();<a name="line.2750"></a>
+<span class="sourceLineNo">2751</span>  }<a name="line.2751"></a>
+<span class="sourceLineNo">2752</span><a name="line.2752"></a>
+<span class="sourceLineNo">2753</span>  @VisibleForTesting<a name="line.2753"></a>
+<span class="sourceLineNo">2754</span>  public void setInitialized(boolean isInitialized) {<a name="line.2754"></a>
+<span class="sourceLineNo">2755</span>    procedureExecutor.getEnvironment().setEventReady(initialized, isInitialized);<a name="line.2755"></a>
+<span class="sourceLineNo">2756</span>  }<a name="line.2756"></a>
+<span class="sourceLineNo">2757</span><a name="line.2757"></a>
+<span class="sourceLineNo">2758</span>  @Override<a name="line.2758"></a>
+<span class="sourceLineNo">2759</span>  public ProcedureEvent&lt;?&gt; getInitializedEvent() {<a name="line.2759"></a>
+<span class="sourceLineNo">2760</span>    return initialized;<a name="line.2760"></a>
+<span class="sourceLineNo">2761</span>  }<a name="line.2761"></a>
+<span class="sourceLineNo">2762</span><a name="line.2762"></a>
+<span class="sourceLineNo">2763</span>  /**<a name="line.2763"></a>
+<span class="sourceLineNo">2764</span>   * ServerCrashProcessingEnabled is set false before completing assignMeta to prevent processing<a name="line.2764"></a>
+<span class="sourceLineNo">2765</span>   * of crashed servers.<a name="line.2765"></a>
+<span class="sourceLineNo">2766</span>   * @return true if assignMeta has completed;<a name="line.2766"></a>
+<span class="sourceLineNo">2767</span>   */<a name="line.2767"></a>
+<span class="sourceLineNo">2768</span>  @Override<a name="line.2768"></a>
+<span class="sourceLineNo">2769</span>  public boolean isServerCrashProcessingEnabled() {<a name="line.2769"></a>
+<span class="sourceLineNo">2770</span>    return serverCrashProcessingEnabled.isReady();<a name="line.2770"></a>
+<span class="sourceLineNo">2771</span>  }<a name="line.2771"></a>
+<span class="sourceLineNo">2772</span><a name="line.2772"></a>
+<span class="sourceLineNo">2773</span>  @VisibleForTesting<a name="line.2773"></a>
+<span class="sourceLineNo">2774</span>  public void setServerCrashProcessingEnabled(final boolean b) {<a name="line.2774"></a>
+<span class="sourceLineNo">2775</span>    procedureExecutor.getEnvironment().setEventReady(serverCrashProcessingEnabled, b);<a name="line.2775"></a>
+<span class="sourceLineNo">2776</span>  }<a name="line.2776"></a>
+<span class="sourceLineNo">2777</span><a name="line.2777"></a>
+<span class="sourceLineNo">2778</span>  public ProcedureEvent&lt;?&gt; getServerCrashProcessingEnabledEvent() {<a name="line.2778"></a>
+<span class="sourceLineNo">2779</span>    return serverCrashProcessingEnabled;<a name="line.2779"></a>
+<span class="sourceLineNo">2780</span>  }<a name="line.2780"></a>
+<span class="sourceLineNo">2781</span><a name="line.2781"></a>
+<span class="sourceLineNo">2782</span>  /**<a name="line.2782"></a>
+<span class="sourceLineNo">2783</span>   * Compute the average load across all region servers.<a name="line.2783"></a>
+<span class="sourceLineNo">2784</span>   * Currently, this uses a very naive computation - just uses the number of<a name="line.2784"></a>
+<span class="sourceLineNo">2785</span>   * regions being served, ignoring stats about number of requests.<a name="line.2785"></a>
+<span class="sourceLineNo">2786</span>   * @return the average load<a name="line.2786"></a>
+<span class="sourceLineNo">2787</span>   */<a name="line.2787"></a>
+<span class="sourceLineNo">2788</span>  public double getAverageLoad() {<a name="line.2788"></a>
+<span class="sourceLineNo">2789</span>    if (this.assignmentManager == null) {<a name="line.2789"></a>
+<span class="sourceLineNo">2790</span>      return 0;<a name="line.2790"></a>
+<span class="sourceLineNo">2791</span>    }<a name="line.2791"></a>
+<span class="sourceLineNo">2792</span><a name="line.2792"></a>
+<span class="sourceLineNo">2793</span>    RegionStates regionStates = this.assignmentManager.getRegionStates();<a name="line.2793"></a>
+<span class="sourceLineNo">2794</span>    if (regionStates == null) {<a name="line.2794"></a>
+<span class="sourceLineNo">2795</span>      return 0;<a name="line.2795"></a>
+<span class="sourceLineNo">2796</span>    }<a name="line.2796"></a>
+<span class="sourceLineNo">2797</span>    return regionStates.getAverageLoad();<a name="line.2797"></a>
+<span class="sourceLineNo">2798</span>  }<a name="line.2798"></a>
+<span class="sourceLineNo">2799</span><a name="line.2799"></a>
+<span class="sourceLineNo">2800</span>  /*<a name="line.2800"></a>
+<span class="sourceLineNo">2801</span>   * @return the count of region split plans executed<a name="line.2801"></a>
+<span class="sourceLineNo">2802</span>   */<a name="line.2802"></a>
+<span class="sourceLineNo">2803</span>  public long getSplitPlanCount() {<a name="line.2803"></a>
+<span class="sourceLineNo">2804</span>    return splitPlanCount;<a name="line.2804"></a>
+<span class="sourceLineNo">2805</span>  }<a name="line.2805"></a>
+<span class="sourceLineNo">2806</span><a name="line.2806"></a>
+<span class="sourceLineNo">2807</span>  /*<a name="line.2807"></a>
+<span class="sourceLineNo">2808</span>   * @return the count of region merge plans executed<a name="line.2808"></a>
+<span class="sourceLineNo">2809</span>   */<a name="line.2809"></a>
+<span class="sourceLineNo">2810</span>  public long getMergePlanCount() {<a name="line.2810"></a>
+<span class="sourceLineNo">2811</span>    return mergePlanCount;<a name="line.2811"></a>
+<span class="sourceLineNo">2812</span>  }<a name="line.2812"></a>
+<span class="sourceLineNo">2813</span><a name="line.2813"></a>
+<span class="sourceLineNo">2814</span>  @Override<a name="line.2814"></a>
+<span class="sourceLineNo">2815</span>  public boolean registerService(Service instance) {<a name="line.2815"></a>
+<span class="sourceLineNo">2816</span>    /*<a name="line.2816"></a>
+<span class="sourceLineNo">2817</span>     * No stacking of instances is allowed for a single service name<a name="line.2817"></a>
+<span class="sourceLineNo">2818</span>     */<a name="line.2818"></a>
+<span class="sourceLineNo">2819</span>    Descriptors.ServiceDescriptor serviceDesc = instance.getDescriptorForType();<a name="line.2819"></a>
+<span class="sourceLineNo">2820</span>    String serviceName = CoprocessorRpcUtils.getServiceName(serviceDesc);<a name="line.2820"></a>
+<span class="sourceLineNo">2821</span>    if (coprocessorServiceHandlers.containsKey(serviceName)) {<a name="line.2821"></a>
+<span class="sourceLineNo">2822</span>      LOG.error("Coprocessor service "+serviceName+<a name="line.2822"></a>
+<span class="sourceLineNo">2823</span>          " already registered, rejecting request from "+instance<a name="line.2823"></a>
+<span class="sourceLineNo">2824</span>      );<a name="line.2824"></a>
+<span class="sourceLineNo">2825</span>      return false;<a name="line.2825"></a>
+<span class="sourceLineNo">2826</span>    }<a name="line.2826"></a>
+<span class="sourceLineNo">2827</span><a name="line.2827"></a>
+<span class="sourceLineNo">2828</span>    coprocessorServiceHandlers.put(serviceName, instance);<a name="line.2828"></a>
+<span class="sourceLineNo">2829</span>    if (LOG.isDebugEnabled()) {<a name="line.2829"></a>
+<span class="sourceLineNo">2830</span>      LOG.debug("Registered master coprocessor service: service="+serviceName);<a name="line.2830"></a>
+<span class="sourceLineNo">2831</span>    }<a name="line.2831"></a>
+<span class="sourceLineNo">2832</span>    return true;<a name="line.2832"></a>
+<span class="sourceLineNo">2833</span>  }<a name="line.2833"></a>
+<span class="sourceLineNo">2834</span><a name="line.2834"></a>
+<span class="sourceLineNo">2835</span>  /**<a name="line.2835"></a>
+<span class="sourceLineNo">2836</span>   * Utility for constructing an instance of the passed HMaster class.<a name="line.2836"></a>
+<span class="sourceLineNo">2837</span>   * @param masterClass<a name="line.2837"></a>
+<span class="sourceLineNo">2838</span>   * @return HMaster instance.<a name="line.2838"></a>
+<span class="sourceLineNo">2839</span>   */<a name="line.2839"></a>
+<span class="sourceLineNo">2840</span>  public static HMaster constructMaster(Class&lt;? extends HMaster&gt; masterClass,<a name="line.2840"></a>
+<span class="sourceLineNo">2841</span>      final Configuration conf)  {<a name="line.2841"></a>
+<span class="sourceLineNo">2842</span>    try {<a name="line.2842"></a>
+<span class="sourceLineNo">2843</span>      Constructor&lt;? extends HMaster&gt; c = masterClass.getConstructor(Configuration.class);<a name="line.2843"></a>
+<span class="sourceLineNo">2844</span>      return c.newInstance(conf);<a name="line.2844"></a>
+<span class="sourceLineNo">2845</span>    } catch(Exception e) {<a name="line.2845"></a>
+<span class="sourceLineNo">2846</span>      Throwable error = e;<a name="line.2846"></a>
+<span class="sourceLineNo">2847</span>      if (e instanceof InvocationTargetException &amp;&amp;<a name="line.2847"></a>
+<span class="sourceLineNo">2848</span>          ((InvocationTargetException)e).getTargetException() != null) {<a name="line.2848"></a>
+<span class="sourceLineNo">2849</span>        error = ((InvocationTargetException)e).getTargetException();<a name="line.2849"></a>
+<span class="sourceLineNo">2850</span>      }<a name="line.2850"></a>
+<span class="sourceLineNo">2851</span>      throw new RuntimeException("Failed construction of Master: " + masterClass.toString() + ". "<a name="line.2851"></a>
+<span class="sourceLineNo">2852</span>        , error);<a name="line.2852"></a>
+<span class="sourceLineNo">2853</span>    }<a name="line.2853"></a>
+<span class="sourceLineNo">2854</span>  }<a name="line.2854"></a>
+<span class="sourceLineNo">2855</span><a name="line.2855"></a>
+<span class="sourceLineNo">2856</span>  /**<a name="line.2856"></a>
+<span class="sourceLineNo">2857</span>   * @see org.apache.hadoop.hbase.master.HMasterCommandLine<a name="line.2857"></a>
+<span class="sourceLineNo">2858</span>   */<a name="line.2858"></a>
+<span class="sourceLineNo">2859</span>  public static void main(String [] args) {<a name="line.2859"></a>
+<span class="sourceLineNo">2860</span>    LOG.info("STARTING service " + HMaster.class.getSimpleName());<a name="line.2860"></a>
+<span class="sourceLineNo">2861</span>    VersionInfo.logVersion();<a name="line.2861"></a>
+<span class="sourceLineNo">2862</span>    new HMasterCommandLine(HMaster.class).doMain(args);<a name="line.2862"></a>
+<span class="sourceLineNo">2863</span>  }<a name="line.2863"></a>
+<span class="sourceLineNo">2864</span><a name="line.2864"></a>
+<span class="sourceLineNo">2865</span>  public HFileCleaner getHFileCleaner() {<a name="line.2865"></a>
+<span class="sourceLineNo">2866</span>    return this.hfileCleaner;<a name="line.2866"></a>
+<span class="sourceLineNo">2867</span>  }<a name="line.2867"></a>
+<span class="sourceLineNo">2868</span><a name="line.2868"></a>
+<span class="sourceLineNo">2869</span>  public LogCleaner getLogCleaner() {<a name="line.2869"></a>
+<span class="sourceLineNo">2870</span>    return this.logCleaner;<a name="line.2870"></a>
+<span class="sourceLineNo">2871</span>  }<a name="line.2871"></a>
+<span class="sourceLineNo">2872</span><a name="line.2872"></a>
+<span class="sourceLineNo">2873</span>  /**<a name="line.2873"></a>
+<span class="sourceLineNo">2874</span>   * @return the underlying snapshot manager<a name="line.2874"></a>
+<span class="sourceLineNo">2875</span>   */<a name="line.2875"></a>
+<span class="sourceLineNo">2876</span>  @Override<a name="line.2876"></a>
+<span class="sourceLineNo">2877</span>  public SnapshotManager getSnapshotManager() {<a name="line.2877"></a>
+<span class="sourceLineNo">2878</span>    return this.snapshotManager;<a name="line.2878"></a>
+<span class="sourceLineNo">2879</span>  }<a name="line.2879"></a>
+<span class="sourceLineNo">2880</span><a name="line.2880"></a>
+<span class="sourceLineNo">2881</span>  /**<a name="line.2881"></a>
+<span class="sourceLineNo">2882</span>   * @return the underlying MasterProcedureManagerHost<a name="line.2882"></a>
+<span class="sourceLineNo">2883</span>   */<a name="line.2883"></a>
+<span class="sourceLineNo">2884</span>  @Override<a name="line.2884"></a>
+<span class="sourceLineNo">2885</span>  public MasterProcedureManagerHost getMasterProcedureManagerHost() {<a name="line.2885"></a>
+<span class="sourceLineNo">2886</span>    return mpmHost;<a name="line.2886"></a>
+<span class="sourceLineNo">2887</span>  }<a name="line.2887"></a>
+<span class="sourceLineNo">2888</span><a name="line.2888"></a>
+<span class="sourceLineNo">2889</span>  @Override<a name="line.2889"></a>
+<span class="sourceLineNo">2890</span>  public ClusterSchema getClusterSchema() {<a name="line.2890"></a>
+<span class="sourceLineNo">2891</span>    return this.clusterSchemaService;<a name="line.2891"></a>
+<span class="sourceLineNo">2892</span>  }<a name="line.2892"></a>
+<span class="sourceLineNo">2893</span><a name="line.2893"></a>
+<span class="sourceLineNo">2894</span>  /**<a name="line.2894"></a>
+<span class="sourceLineNo">2895</span>   * Create a new Namespace.<a name="line.2895"></a>
+<span class="sourceLineNo">2896</span>   * @param namespaceDescriptor descriptor for new Namespace<a name="line.2896"></a>
+<span class="sourceLineNo">2897</span>   * @param nonceGroup Identifier for the source of the request, a client or process.<a name="line.2897"></a>
+<span class="sourceLineNo">2898</span>   * @param nonce A unique identifier for this operation from the client or process identified by<a name="line.2898"></a>
+<span class="sourceLineNo">2899</span>   * &lt;code&gt;nonceGroup&lt;/code&gt; (the source must ensure each operation gets a unique id).<a name="line.2899"></a>
+<span class="sourceLineNo">2900</span>   * @return procedure id<a name="line.2900"></a>
+<span class="sourceLineNo">2901</span>   */<a name="line.2901"></a>
+<span class="sourceLineNo">2902</span>  long createNamespace(final NamespaceDescriptor namespaceDescriptor, final long nonceGroup,<a name="line.2902"></a>
+<span class="sourceLineNo">2903</span>      final long nonce) throws IOException {<a name="line.2903"></a>
+<span class="sourceLineNo">2904</span>    checkInitialized();<a name="line.2904"></a>
 <span class="sourceLineNo">2905</span><a name="line.2905"></a>
-<span class="sourceLineNo">2906</span>    return MasterProcedureUtil.submitProcedure(new MasterProcedureUtil.NonceProcedureRunnable(this,<a name="line.2906"></a>
-<span class="sourceLineNo">2907</span>          nonceGroup, nonce) {<a name="line.2907"></a>
-<span class="sourceLineNo">2908</span>      @Override<a name="line.2908"></a>
-<span class="sourceLineNo">2909</span>      protected void run() throws IOException {<a name="line.2909"></a>
-<span class="sourceLineNo">2910</span>        getMaster().getMasterCoprocessorHost().preCreateNamespace(namespaceDescriptor);<a name="line.2910"></a>
-<span class="sourceLineNo">2911</span>        LOG.info(getClientIdAuditPrefix() + " creating " + namespaceDescriptor);<a name="line.2911"></a>
-<span class="sourceLineNo">2912</span>        // Execute the operation synchronously - wait for the operation to complete before<a name="line.2912"></a>
-<span class="sourceLineNo">2913</span>        // continuing.<a name="line.2913"></a>
-<span class="sourceLineNo">2914</span>        setProcId(getClusterSchema().createNamespace(namespaceDescriptor, getNonceKey()));<a name="line.2914"></a>
-<span class="sourceLineNo">2915</span>        getMaster().getMasterCoprocessorHost().postCreateNamespace(namespaceDescriptor);<a name="line.2915"></a>
-<span class="sourceLineNo">2916</span>      }<a name="line.2916"></a>
-<span class="sourceLineNo">2917</span><a name="line.2917"></a>
-<span class="sourceLineNo">2918</span>      @Override<a name="line.2918"></a>
-<span class="sourceLineNo">2919</span>      protected String getDescription() {<a name="line.2919"></a>
-<span class="sourceLineNo">2920</span>        return "CreateNamespaceProcedure";<a name="line.2920"></a>
-<span class="sourceLineNo">2921</span>      }<a name="line.2921"></a>
-<span class="sourceLineNo">2922</span>    });<a name="line.2922"></a>
-<span class="sourceLineNo">2923</span>  }<a name="line.2923"></a>
-<span class="sourceLineNo">2924</span><a name="line.2924"></a>
-<span class="sourceLineNo">2925</span>  /**<a name="line.2925"></a>
-<span class="sourceLineNo">2926</span>   * Modify an existing Namespace.<a name="line.2926"></a>
-<span class="sourceLineNo">2927</span>   * @param nonceGroup Identifier for the source of the request, a client or process.<a name="line.2927"></a>
-<span class="sourceLineNo">2928</span>   * @param nonce A unique identifier for this operation from the client or process identified by<a name="line.2928"></a>
-<span class="sourceLineNo">2929</span>   * &lt;code&gt;nonceGroup&lt;/code&gt; (the source must ensure each operation gets a unique id).<a name="line.2929"></a>
-<span class="sourceLineNo">2930</span>   * @return procedure id<a name="line.2930"></a>
-<span class="sourceLineNo">2931</span>   */<a name="line.2931"></a>
-<span class="sourceLineNo">2932</span>  long modifyNamespace(final NamespaceDescriptor namespaceDescriptor, final long nonceGroup,<a name="line.2932"></a>
-<span class="sourceLineNo">2933</span>      final long nonce) throws IOException {<a name="line.2933"></a>
-<span class="sourceLineNo">2934</span>    checkInitialized();<a name="line.2934"></a>
-<span class="sourceLineNo">2935</span><a name="line.2935"></a>
-<span class="sourceLineNo">2936</span>    TableName.isLegalNamespaceName(Bytes.toBytes(namespaceDescriptor.getName()));<a name="line.2936"></a>
+<span class="sourceLineNo">2906</span>    TableName.isLegalNamespaceName(Bytes.toBytes(namespaceDescriptor.getName()));<a name="line.2906"></a>
+<span class="sourceLineNo">2907</span><a name="line.2907"></a>
+<span class="sourceLineNo">2908</span>    return MasterProcedureUtil.submitProcedure(new MasterProcedureUtil.NonceProcedureRunnable(this,<a name="line.2908"></a>
+<span class="sourceLineNo">2909</span>          nonceGroup, nonce) {<a name="line.2909"></a>
+<span class="sourceLineNo">2910</span>      @Override<a name="line.2910"></a>
+<span class="sourceLineNo">2911</span>      protected void run() throws IOException {<a name="line.2911"></a>
+<span class="sourceLineNo">2912</span>        getMaster().getMasterCoprocessorHost().preCreateNamespace(namespaceDescriptor);<a name="line.2912"></a>
+<span class="sourceLineNo">2913</span>        LOG.info(getClientIdAuditPrefix() + " creating " + namespaceDescriptor);<a name="line.2913"></a>
+<span class="sourceLineNo">2914</span>        // Execute the operation synchronously - wait for the operation to complete before<a name="line.2914"></a>
+<span class="sourceLineNo">2915</span>        // continuing.<a name="line.2915"></a>
+<span class="sourceLineNo">2916</span>        setProcId(getClusterSchema().createNamespace(namespaceDescriptor, getNonceKey()));<a name="line.2916"></a>
+<span class="sourceLineNo">2917</span>        getMaster().getMasterCoprocessorHost().postCreateNamespace(namespaceDescriptor);<a name="line.2917"></a>
+<span class="sourceLineNo">2918</span>      }<a name="line.2918"></a>
+<span class="sourceLineNo">2919</span><a name="line.2919"></a>
+<span class="sourceLineNo">2920</span>      @Override<a name="line.2920"></a>
+<span class="sourceLineNo">2921</span>      protected String getDescription() {<a name="line.2921"></a>
+<span class="sourceLineNo">2922</span>        return "CreateNamespaceProcedure";<a name="line.2922"></a>
+<span class="sourceLineNo">2923</span>      }<a name="line.2923"></a>
+<span class="sourceLineNo">2924</span>    });<a name="line.2924"></a>
+<span class="sourceLineNo">2925</span>  }<a name="line.2925"></a>
+<span class="sourceLineNo">2926</span><a name="line.2926"></a>
+<span class="sourceLineNo">2927</span>  /**<a name="line.2927"></a>
+<span class="sourceLineNo">2928</span>   * Modify an existing Namespace.<a name="line.2928"></a>
+<span class="sourceLineNo">2929</span>   * @param nonceGroup Identifier for the source of the request, a client or process.<a name="line.2929"></a>
+<span class="sourceLineNo">2930</span>   * @param nonce A unique identifier for this operation from the client or process identified by<a name="line.2930"></a>
+<span class="sourceLineNo">2931</span>   * &lt;code&gt;nonceGroup&lt;/code&gt; (the source must ensure each operation gets a unique id).<a name="line.2931"></a>
+<span class="sourceLineNo">2932</span>   * @return procedure id<a name="line.2932"></a>
+<span class="sourceLineNo">2933</span>   */<a name="line.2933"></a>
+<span class="sourceLineNo">2934</span>  long modifyNamespace(final NamespaceDescriptor namespaceDescriptor, final long nonceGroup,<a name="line.2934"></a>
+<span class="sourceLineNo">2935</span>      final long nonce) throws IOException {<a name="line.2935"></a>
+<span class="sourceLineNo">2936</span>    checkInitialized();<a name="line.2936"></a>
 <span class="sourceLineNo">2937</span><a name="line.2937"></a>
-<span class="sourceLineNo">2938</span>    return MasterProcedureUtil.submitProcedure(new MasterProcedureUtil.NonceProcedureRunnable(this,<a name="line.2938"></a>
-<span class="sourceLineNo">2939</span>          nonceGroup, nonce) {<a name="line.2939"></a>
-<span class="sourceLineNo">2940</span>      @Override<a name="line.2940"></a>
-<span class="sourceLineNo">2941</span>      protected void run() throws IOException {<a name="line.2941"></a>
-<span class="sourceLineNo">2942</span>        getMaster().getMasterCoprocessorHost().preModifyNamespace(namespaceDescriptor);<a name="line.2942"></a>
-<span class="sourceLineNo">2943</span>        LOG.info(getClientIdAuditPrefix() + " modify " + namespaceDescriptor);<a name="line.2943"></a>
-<span class="sourceLineNo">2944</span>        // Execute the operation synchronously - wait for the operation to complete before<a name="line.2944"></a>
-<span class="sourceLineNo">2945</span>        // continuing.<a name="line.2945"></a>
-<span class="sourceLineNo">2946</span>        setProcId(getClusterSchema().modifyNamespace(namespaceDescriptor, getNonceKey()));<a name="line.2946"></a>
-<span class="sourceLineNo">2947</span>        getMaster().getMasterCoprocessorHost().postModifyNamespace(namespaceDescriptor);<a name="line.2947"></a>
-<span class="sourceLineNo">2948</span>      }<a name="line.2948"></a>
-<span class="sourceLineNo">2949</span><a name="line.2949"></a>
-<span class="sourceLineNo">2950</span>      @Override<a name="line.2950"></a>
-<span class="sourceLineNo">2951</span>      protected String getDescription() {<a name="line.2951"></a>
-<span class="sourceLineNo">2952</span>        return "ModifyNamespaceProcedure";<a name="line.2952"></a>
-<span class="sourceLineNo">2953</span>      }<a name="line.2953"></a>
-<span class="sourceLineNo">2954</span>    });<a name="line.2954"></a>
-<span class="sourceLineNo">2955</span>  }<a name="line.2955"></a>
-<span class="sourceLineNo">2956</span><a name="line.2956"></a>
-<span class="sourceLineNo">2957</span>  /**<a name="line.2957"></a>
-<span class="sourceLineNo">2958</span>   * Delete an existing Namespace. Only empty Namespaces (no tables) can be removed.<a name="line.2958"></a>
-<span class="sourceLineNo">2959</span>   * @param nonceGroup Identifier for the source of the request, a client or process.<a name="line.2959"></a>
-<span class="sourceLineNo">2960</span>   * @param nonce A unique identifier for this operation from the client or process identified by<a name="line.2960"></a>
-<span class="sourceLineNo">2961</span>   * &lt;code&gt;nonceGroup&lt;/code&gt; (the source must ensure each operation gets a unique id).<a name="line.2961"></a>
-<span class="sourceLineNo">2962</span>   * @return procedure id<a name="line.2962"></a>
-<span class="sourceLineNo">2963</span>   */<a name="line.2963"></a>
-<span class="sourceLineNo">2964</span>  long deleteNamespace(final String name, final long nonceGroup, final long nonce)<a name="line.2964"></a>
-<span class="sourceLineNo">2965</span>      throws IOException {<a name="line.2965"></a>
-<span class="sourceLineNo">2966</span>    checkInitialized();<a name="line.2966"></a>
-<span class="sourceLineNo">2967</span><a name="line.2967"></a>
-<span class="sourceLineNo">2968</span>    return MasterProcedureUtil.submitProcedure(new MasterProcedureUtil.NonceProcedureRunnable(this,<a name="line.2968"></a>
-<span class="sourceLineNo">2969</span>          nonceGroup, nonce) {<a name="line.2969"></a>
-<span class="sourceLineNo">2970</span>      @Override<a name="line.2970"></a>
-<span class="sourceLineNo">2971</span>      protected void run() throws IOException {<a name="line.2971"></a>
-<span class="sourceLineNo">2972</span>        getMaster().getMasterCoprocessorHost().preDeleteNamespace(name);<a name="line.2972"></a>
-<span class="sourceLineNo">2973</span>        LOG.info(getClientIdAuditPrefix() + " delete " + name);<a name="line.2973"></a>
-<span class="sourceLineNo">2974</span>        // Execute the operation synchronously - wait for the operation to complete before<a name="line.2974"></a>
-<span class="sourceLineNo">2975</span>        // continuing.<a name="line.2975"></a>
-<span class="sourceLineNo">2976</span>        setProcId(getClusterSchema().deleteNamespace(name, getNonceKey()));<a name="line.2976"></a>
-<span class="sourceLineNo">2977</span>        getMaster().getMasterCoprocessorHost().postDeleteNamespace(name);<a name="line.2977"></a>
-<span class="sourceLineNo">2978</span>      }<a name="line.2978"></a>
-<span class="sourceLineNo">2979</span><a name="line.2979"></a>
-<span class="sourceLineNo">2980</span>      @Override<a name="line.2980"></a>
-<span class="sourceLineNo">2981</span>      protected String getDescription() {<a name="line.2981"></a>
-<span class="sourceLineNo">2982</span>        return "DeleteNamespaceProcedure";<a name="line.2982"></a>
-<span class="sourceLineNo">2983</span>      }<a name="line.2983"></a>
-<span class="sourceLineNo">2984</span>    });<a name="line.2984"></a>
-<span class="sourceLineNo">2985</span>  }<a name="line.2985"></a>
-<span class="sourceLineNo">2986</span><a name="line.2986"></a>
-<span class="sourceLineNo">2987</span>  /**<a name="line.2987"></a>
-<span class="sourceLineNo">2988</span>   * Get a Namespace<a name="line.2988"></a>
-<span class="sourceLineNo">2989</span>   * @param name Name of the Namespace<a name="line.2989"></a>
-<span class="sourceLineNo">2990</span>   * @return Namespace descriptor for &lt;code&gt;name&lt;/code&gt;<a name="line.2990"></a>
-<span class="sourceLineNo">2991</span>   */<a name="line.2991"></a>
-<span class="sourceLineNo">2992</span>  NamespaceDescriptor getNamespace(String name) throws IOException {<a name="line.2992"></a>
-<span class="sourceLineNo">2993</span>    checkInitialized();<a name="line.2993"></a>
-<span class="sourceLineNo">2994</span>    if (this.cpHost != null) this.cpHost.preGetNamespaceDescriptor(name);<a name="line.2994"></a>
-<span class="sourceLineNo">2995</span>    NamespaceDescriptor nsd = this.clusterSchemaService.getNamespace(name);<a name="line.2995"></a>
-<span class="sourceLineNo">2996</span>    if (this.cpHost != null) this.cpHost.postGetNamespaceDescriptor(nsd);<a name="line.2996"></a>
-<span class="sourceLineNo">2997</span>    return nsd;<a name="line.2997"></a>
-<span class="sourceLineNo">2998</span>  }<a name="line.2998"></a>
-<span class="sourceLineNo">2999</span><a name="line.2999"></a>
-<span class="sourceLineNo">3000</span>  /**<a name="line.3000"></a>
-<span class="sourceLineNo">3001</span>   * Get all Namespaces<a name="line.3001"></a>
-<span class="sourceLineNo">3002</span>   * @return All Namespace descriptors<a name="line.3002"></a>
-<span class="sourceLineNo">3003</span>   */<a name="line.3003"></a>
-<span class="sourceLineNo">3004</span>  List&lt;NamespaceDescriptor&gt; getNamespaces() throws IOException {<a name="line.3004"></a>
-<span class="sourceLineNo">3005</span>    checkInitialized();<a name="line.3005"></a>
-<span class="sourceLineNo">3006</span>    final List&lt;NamespaceDescriptor&gt; nsds = new ArrayList&lt;&gt;();<a name="line.3006"></a>
-<span class="sourceLineNo">3007</span>    if (cpHost != null) {<a name="line.3007"></a>
-<span class="sourceLineNo">3008</span>      cpHost.preListNamespaceDescriptors(nsds);<a name="line.3008"></a>
-<span class="sourceLineNo">3009</span>    }<a name="line.3009"></a>
-<span class="sourceLineNo">3010</span>    nsds.addAll(this.clusterSchemaService.getNamespaces());<a name="line.3010"></a>
-<span class="sourceLineNo">3011</span>    if (this.cpHost != null) {<a name="line.3011"></a>
-<span class="sourceLineNo">3012</span>      this.cpHost.postListNamespaceDescriptors(nsds);<a name="line.3012"></a>
-<span class="sourceLineNo">3013</span>    }<a name="line.3013"></a>
-<span class="sourceLineNo">3014</span>    return nsds;<a name="line.3014"></a>
-<span class="sourceLineNo">3015</span>  }<a name="line.3015"></a>
-<span class="sourceLineNo">3016</span><a name="line.3016"></a>
-<span class="sourceLineNo">3017</span>  @Override<a name="line.3017"></a>
-<span class="sourceLineNo">3018</span>  public List&lt;TableName&gt; listTableNamesByNamespace(String name) throws IOException {<a name="line.3018"></a>
-<span class="sourceLineNo">3019</span>    checkInitialized();<a name="line.3019"></a>
-<span class="sourceLineNo">3020</span>    return listTableNames(name, null, true);<a name="line.3020"></a>
-<span class="sourceLineNo">3021</span>  }<a name="line.3021"></a>
-<span class="sourceLineNo">3022</span><a name="line.3022"></a>
-<span class="sourceLineNo">3023</span>  @Override<a name="line.3023"></a>
-<span class="sourceLineNo">3024</span>  public List&lt;TableDescriptor&gt; listTableDescriptorsByNamespace(String name) throws IOException {<a name="line.3024"></a>
-<span class="sourceLineNo">3025</span>    checkInitialized();<a name="line.3025"></a>
-<span class="sourceLineNo">3026</span>    return listTableDescriptors(name, null, null, true);<a name="line.3026"></a>
-<span class="sourceLineNo">3027</span>  }<a name="line.3027"></a>
-<span class="sourceLineNo">3028</span><a name="line.3028"></a>
-<span class="sourceLineNo">3029</span>  @Override<a name="line.3029"></a>
-<span class="sourceLineNo">3030</span>  public boolean abortProcedure(final long procId, final boolean mayInterruptIfRunning)<a name="line.3030"></a>
-<span class="sourceLineNo">3031</span>      throws IOException {<a name="line.3031"></a>
-<span class="sourceLineNo">3032</span>    if (cpHost != null) {<a name="line.3032"></a>
-<span class="sourceLineNo">3033</span>      cpHost.preAbortProcedure(this.procedureExecutor, procId);<a name="line.3033"></a>
-<span class="sourceLineNo">3034</span>    }<a name="line.3034"></a>
-<span class="sourceLineNo">3035</span><a name="line.3035"></a>
-<span class="sourceLineNo">3036</span>    final boolean result = this.procedureExecutor.abort(procId, mayInterruptIfRunning);<a name="line.3036"></a>
+<span class="sourceLineNo">2938</span>    TableName.isLegalNamespaceName(Bytes.toBytes(namespaceDescriptor.getName()));<a name="line.2938"></a>
+<span class="sourceLineNo">2939</span><a name="line.2939"></a>
+<span class="sourceLineNo">2940</span>    return MasterProcedureUtil.submitProcedure(new MasterProcedureUtil.NonceProcedureRunnable(this,<a name="line.2940"></a>
+<span class="sourceLineNo">2941</span>          nonceGroup, nonce) {<a name="line.2941"></a>
+<span class="sourceLineNo">2942</span>      @Override<a name="line.2942"></a>
+<span class="sourceLineNo">2943</span>      protected void run() throws IOException {<a name="line.2943"></a>
+<span class="sourceLineNo">2944</span>        getMaster().getMasterCoprocessorHost().preModifyNamespace(namespaceDescriptor);<a name="line.2944"></a>
+<span class="sourceLineNo">2945</span>        LOG.info(getClientIdAuditPrefix() + " modify " + namespaceDescriptor);<a name="line.2945"></a>
+<span class="sourceLineNo">2946</span>        // Execute the operation synchronously - wait for the operation to complete before<a name="line.2946"></a>
+<span class="sourceLineNo">2947</span>        // continuing.<a name="line.2947"></a>
+<span class="sourceLineNo">2948</span>        setProcId(getClusterSchema().modifyNamespace(namespaceDescriptor, getNonceKey()));<a name="line.2948"></a>
+<span class="sourceLineNo">2949</span>        getMaster().getMasterCoprocessorHost().postModifyNamespace(namespaceDescriptor);<a name="line.2949"></a>
+<span class="sourceLineNo">2950</span>      }<a name="line.2950"></a>
+<span class="sourceLineNo">2951</span><a name="line.2951"></a>
+<span class="sourceLineNo">2952</span>      @Override<a name="line.2952"></a>
+<span class="sourceLineNo">2953</span>      protected String getDescription() {<a name="line.2953"></a>
+<span class="sourceLineNo">2954</span>        return "ModifyNamespaceProcedure";<a name="line.2954"></a>
+<span class="sourceLineNo">2955</span>      }<a name="line.2955"></a>
+<span class="sourceLineNo">2956</span>    });<a name="line.2956"></a>
+<span class="sourceLineNo">2957</span>  }<a name="line.2957"></a>
+<span class="sourceLineNo">2958</span><a name="line.2958"></a>
+<span class="sourceLineNo">2959</span>  /**<a name="line.2959"></a>
+<span class="sourceLineNo">2960</span>   * Delete an existing Namespace. Only empty Namespaces (no tables) can be removed.<a name="line.2960"></a>
+<span class="sourceLineNo">2961</span>   * @param nonceGroup Identifier for the source of the request, a client or process.<a name="line.2961"></a>
+<span class="sourceLineNo">2962</span>   * @param nonce A unique identifier for this operation from the client or process identified by<a name="line.2962"></a>
+<span class="sourceLineNo">2963</span>   * &lt;code&gt;nonceGroup&lt;/code&gt; (the source must ensure each operation gets a unique id).<a name="line.2963"></a>
+<span class="sourceLineNo">2964</span>   * @return procedure id<a name="line.2964"></a>
+<span class="sourceLineNo">2965</span>   */<a name="line.2965"></a>
+<span class="sourceLineNo">2966</span>  long deleteNamespace(final String name, final long nonceGroup, final long nonce)<a name="line.2966"></a>
+<span class="sourceLineNo">2967</span>      throws IOException {<a name="line.2967"></a>
+<span class="sourceLineNo">2968</span>    checkInitialized();<a name="line.2968"></a>
+<span class="sourceLineNo">2969</span><a name="line.2969"></a>
+<span class="sourceLineNo">2970</span>    return MasterProcedureUtil.submitProcedure(new MasterProcedureUtil.NonceProcedureRunnable(this,<a name="line.2970"></a>
+<span class="sourceLineNo">2971</span>          nonceGroup, nonce) {<a name="line.2971"></a>
+<span class="sourceLineNo">2972</span>      @Override<a name="line.2972"></a>
+<span class="sourceLineNo">2973</span>      protected void run() throws IOException {<a name="line.2973"></a>
+<span class="sourceLineNo">2974</span>        getMaster().getMasterCoprocessorHost().preDeleteNamespace(name);<a name="line.2974"></a>
+<span class="sourceLineNo">2975</span>        LOG.info(getClientIdAuditPrefix() + " delete " + name);<a name="line.2975"></a>
+<span class="sourceLineNo">2976</span>        // Execute the operation synchronously - wait for the operation to complete before<a name="line.2976"></a>
+<span class="sourceLineNo">2977</span>        // continuing.<a name="line.2977"></a>
+<span class="sourceLineNo">2978</span>        setProcId(getClusterSchema().deleteNamespace(name, getNonceKey()));<a name="line.2978"></a>
+<span class="sourceLineNo">2979</span>        getMaster().getMasterCoprocessorHost().postDeleteNamespace(name);<a name="line.2979"></a>
+<span class="sourceLineNo">2980</span>      }<a name="line.2980"></a>
+<span class="sourceLineNo">2981</span><a name="line.2981"></a>
+<span class="sourceLineNo">2982</span>      @Override<a name="line.2982"></a>
+<span class="sourceLineNo">2983</span>      protected String getDescription() {<a name="line.2983"></a>
+<span class="sourceLineNo">2984</span>        return "DeleteNamespaceProcedure";<a name="line.2984"></a>
+<span class="sourceLineNo">2985</span>      }<a name="line.2985"></a>
+<span class="sourceLineNo">2986</span>    });<a name="line.2986"></a>
+<span class="sourceLineNo">2987</span>  }<a name="line.2987"></a>
+<span class="sourceLineNo">2988</span><a name="line.2988"></a>
+<span class="sourceLineNo">2989</span>  /**<a name="line.2989"></a>
+<span class="sourceLineNo">2990</span>   * Get a Namespace<a name="line.2990"></a>
+<span class="sourceLineNo">2991</span>   * @param name Name of the Namespace<a name="line.2991"></a>
+<span class="sourceLineNo">2992</span>   * @return Namespace descriptor for &lt;code&gt;name&lt;/code&gt;<a name="line.2992"></a>
+<span class="sourceLineNo">2993</span>   */<a name="line.2993"></a>
+<span class="sourceLineNo">2994</span>  NamespaceDescriptor getNamespace(String name) throws IOException {<a name="line.2994"></a>
+<span class="sourceLineNo">2995</span>    checkInitialized();<a name="line.2995"></a>
+<span class="sourceLineNo">2996</span>    if (this.cpHost != null) this.cpHost.preGetNamespaceDescriptor(name);<a name="line.2996"></a>
+<span class="sourceLineNo">2997</span>    NamespaceDescriptor nsd = this.clusterSchemaService.getNamespace(name);<a name="line.2997"></a>
+<span class="sourceLineNo">2998</span>    if (this.cpHost != null) this.cpHost.postGetNamespaceDescriptor(nsd);<a name="line.2998"></a>
+<span class="sourceLineNo">2999</span>    return nsd;<a name="line.2999"></a>
+<span class="sourceLineNo">3000</span>  }<a name="line.3000"></a>
+<span class="sourceLineNo">3001</span><a name="line.3001"></a>
+<span class="sourceLineNo">3002</span>  /**<a name="line.3002"></a>
+<span class="sourceLineNo">3003</span>   * Get all Namespaces<a name="line.3003"></a>
+<span class="sourceLineNo">3004</span>   * @return All Namespace descriptors<a name="line.3004"></a>
+<span class="sourceLineNo">3005</span>   */<a name="line.3005"></a>
+<span class="sourceLineNo">3006</span>  List&lt;NamespaceDescriptor&gt; getNamespaces() throws IOException {<a name="line.3006"></a>
+<span class="sourceLineNo">3007</span>    checkInitialized();<a name="line.3007"></a>
+<span class="sourceLineNo">3008</span>    final List&lt;NamespaceDescriptor&gt; nsds = new ArrayList&lt;&gt;();<a name="line.3008"></a>
+<span class="sourceLineNo">3009</span>    if (cpHost != null) {<a name="line.3009"></a>
+<span class="sourceLineNo">3010</span>      cpHost.preListNamespaceDescriptors(nsds);<a name="line.3010"></a>
+<span class="sourceLineNo">3011</span>    }<a name="line.3011"></a>
+<span class="sourceLineNo">3012</span>    nsds.addAll(this.clusterSchemaService.getNamespaces());<a name="line.3012"></a>
+<span class="sourceLineNo">3013</span>    if (this.cpHost != null) {<a name="line.3013"></a>
+<span class="sourceLineNo">3014</span>      this.cpHost.postListNamespaceDescriptors(nsds);<a name="line.3014"></a>
+<span class="sourceLineNo">3015</span>    }<a name="line.3015"></a>
+<span class="sourceLineNo">3016</span>    return nsds;<a name="line.3016"></a>
+<span class="sourceLineNo">3017</span>  }<a name="line.3017"></a>
+<span class="sourceLineNo">3018</span><a name="line.3018"></a>
+<span class="sourceLineNo">3019</span>  @Override<a name="line.3019"></a>
+<span class="sourceLineNo">3020</span>  public List&lt;TableName&gt; listTableNamesByNamespace(String name) throws IOException {<a name="line.3020"></a>
+<span class="sourceLineNo">3021</span>    checkInitialized();<a name="line.3021"></a>
+<span class="sourceLineNo">3022</span>    return listTableNames(name, null, true);<a name="line.3022"></a>
+<span class="sourceLineNo">3023</span>  }<a name="line.3023"></a>
+<span class="sourceLineNo">3024</span><a name="line.3024"></a>
+<span class="sourceLineNo">3025</span>  @Override<a name="line.3025"></a>
+<span class="sourceLineNo">3026</span>  public List&lt;TableDescriptor&gt; listTableDescriptorsByNamespace(String name) throws IOException {<a name="line.3026"></a>
+<span class="sourceLineNo">3027</span>    checkInitialized();<a name="line.3027"></a>
+<span class="sourceLineNo">3028</span>    return listTableDescriptors(name, null, null, true);<a name="line.3028"></a>
+<span class="sourceLineNo">3029</span>  }<a name="line.3029"></a>
+<span class="sourceLineNo">3030</span><a name="line.3030"></a>
+<span class="sourceLineNo">3031</span>  @Override<a name="line.3031"></a>
+<span class="sourceLineNo">3032</span>  public boolean abortProcedure(final long procId, final boolean mayInterruptIfRunning)<a name="line.3032"></a>
+<span class="sourceLineNo">3033</span>      throws IOException {<a name="line.3033"></a>
+<span class="sourceLineNo">3034</span>    if (cpHost != null) {<a name="line.3034"></a>
+<span class="sourceLineNo">3035</span>      cpHost.preAbortProcedure(this.procedureExecutor, procId);<a name="line.3035"></a>
+<span class="sourceLineNo">3036</span>    }<a name="line.3036"></a>
 <span class="sourceLineNo">3037</span><a name="line.3037"></a>
-<span class="sourceLineNo">3038</span>    if (cpHost != null) {<a name="line.3038"></a>
-<span class="sourceLineNo">3039</span>      cpHost.postAbortProcedure();<a name="line.3039"></a>
-<span class="sourceLineNo">3040</span>    }<a name="line.3040"></a>
-<span class="sourceLineNo">3041</span><a name="line.3041"></a>
-<span class="sourceLineNo">3042</span>    return result;<a name="line.3042"></a>
-<span class="sourceLineNo">3043</span>  }<a name="line.3043"></a>
-<span class="sourceLineNo">3044</span><a name="line.3044"></a>
-<span class="sourceLineNo">3045</span>  @Override<a name="line.3045"></a>
-<span class="sourceLineNo">3046</span>  public List&lt;Procedure&lt;?&gt;&gt; getProcedures() throws IOException {<a name="line.3046"></a>
-<span class="sourceLineNo">3047</span>    if (cpHost != null) {<a name="line.3047"></a>
-<span class="sourceLineNo">3048</span>      cpHost.preGetProcedures();<a name="line.3048"></a>
-<span class="sourceLineNo">3049</span>    }<a name="line.3049"></a>
-<span class="sourceLineNo">3050</span><a name="line.3050"></a>
-<span class="sourceLineNo">3051</span>    final List&lt;Procedure&lt;?&gt;&gt; procList = this.procedureExecutor.getProcedures();<a name="line.3051"></a>
+<span class="sourceLineNo">3038</span>    final boolean result = this.procedureExecutor.abort(procId, mayInterruptIfRunning);<a name="line.3038"></a>
+<span class="sourceLineNo">3039</span><a name="line.3039"></a>
+<span class="sourceLineNo">3040</span>    if (cpHost != null) {<a name="line.3040"></a>
+<span class="sourceLineNo">3041</span>      cpHost.postAbortProcedure();<a name="line.3041"></a>
+<span class="sourceLineNo">3042</span>    }<a name="line.3042"></a>
+<span class="sourceLineNo">3043</span><a name="line.3043"></a>
+<span class="sourceLineNo">3044</span>    return result;<a name="line.3044"></a>
+<span class="sourceLineNo">3045</span>  }<a name="line.3045"></a>
+<span class="sourceLineNo">3046</span><a name="line.3046"></a>
+<span class="sourceLineNo">3047</span>  @Override<a name="line.3047"></a>
+<span class="sourceLineNo">3048</span>  public List&lt;Procedure&lt;?&gt;&gt; getProcedures() throws IOException {<a name="line.3048"></a>
+<span class="sourceLineNo">3049</span>    if (cpHost != null) {<a name="line.3049"></a>
+<span class="sourceLineNo">3050</span>      cpHost.preGetProcedures();<a name="line.3050"></a>
+<span class="sourceLineNo">3051</span>    }<a name="line.3051"></a>
 <span class="sourceLineNo">3052</span><a name="line.3052"></a>
-<span class="sourceLineNo">3053</span>    if (cpHost != null) {<a name="line.3053"></a>
-<span class="sourceLineNo">3054</span>      cpHost.postGetProcedures(procList);<a name="line.3054"></a>
-<span class="sourceLineNo">3055</span>    }<a name="line.3055"></a>
-<span class="sourceLineNo">3056</span><a name="line.3056"></a>
-<span class="sourceLineNo">3057</span>    return procList;<a name="line.3057"></a>
-<span class="sourceLineNo">3058</span>  }<a name="line.3058"></a>
-<span class="sourceLineNo">3059</span><a name="line.3059"></a>
-<span class="sourceLineNo">3060</span>  @Override<a name="line.3060"></a>
-<span class="sourceLineNo">3061</span>  public List&lt;LockedResource&gt; getLocks() throws IOException {<a name="line.3061"></a>
-<span class="sourceLineNo">3062</span>    if (cpHost != null) {<a name="line.3062"></a>
-<span class="sourceLineNo">3063</span>      cpHost.preGetLocks();<a name="line.3063"></a>
-<span class="sourceLineNo">3064</span>    }<a name="line.3064"></a>
-<span class="sourceLineNo">3065</span><a name="line.3065"></a>
-<span class="sourceLineNo">3066</span>    MasterProcedureScheduler procedureScheduler = procedureExecutor.getEnvironment().getProcedureScheduler();<a name="line.3066"></a>
+<span class="sourceLineNo">3053</span>    final List&lt;Procedure&lt;?&gt;&gt; procList = this.procedureExecutor.getProcedures();<a name="line.3053"></a>
+<span class="sourceLineNo">3054</span><a name="line.3054"></a>
+<span class="sourceLineNo">3055</span>    if (cpHost != null) {<a name="line.3055"></a>
+<span class="sourceLineNo">3056</span>      cpHost.postGetProcedures(procList);<a name="line.3056"></a>
+<span class="sourceLineNo">3057</span>    }<a name="line.3057"></a>
+<span class="sourceLineNo">3058</span><a name="line.3058"></a>
+<span class="sourceLineNo">3059</span>    return procList;<a name="line.3059"></a>
+<span class="sourceLineNo">3060</span>  }<a name="line.3060"></a>
+<span class="sourceLineNo">3061</span><a name="line.3061"></a>
+<span class="sourceLineNo">3062</span>  @Override<a name="line.3062"></a>
+<span class="sourceLineNo">3063</span>  public List&lt;LockedResource&gt; getLocks() throws IOException {<a name="line.3063"></a>
+<span class="sourceLineNo">3064</span>    if (cpHost != null) {<a name="line.3064"></a>
+<span class="sourceLineNo">3065</span>      cpHost.preGetLocks();<a name="line.3065"></a>
+<span class="sourceLineNo">3066</span>    }<a name="line.3066"></a>
 <span class="sourceLineNo">3067</span><a name="line.3067"></a>
-<span class="sourceLineNo">3068</span>    final List&lt;LockedResource&gt; lockedResources = procedureScheduler.getLocks();<a name="line.3068"></a>
+<span class="sourceLineNo">3068</span>    MasterProcedureScheduler procedureScheduler = procedureExecutor.getEnvironment().getProcedureScheduler();<a name="line.3068"></a>
 <span class="sourceLineNo">3069</span><a name="line.3069"></a>
-<span class="sourceLineNo">3070</span>    if (cpHost != null) {<a name="line.3070"></a>
-<span class="sourceLineNo">3071</span>      cpHost.postGetLocks(lockedResources);<a name="line.3071"></a>
-<span class="sourceLineNo">3072</span>    }<a name="line.3072"></a>
-<span class="sourceLineNo">3073</span><a name="line.3073"></a>
-<span class="sourceLineNo">3074</span>    return lockedResources;<a name="line.3074"></a>
-<span class="sourceLineNo">3075</span>  }<a name="line.3075"></a>
-<span class="sourceLineNo">3076</span><a name="line.3076"></a>
-<span class="sourceLineNo">3077</span>  /**<a name="line.3077"></a>
-<span class="sourceLineNo">3078</span>   * Returns the list of table descriptors that match the specified request<a name="line.3078"></a>
-<span class="sourceLineNo">3079</span>   * @param namespace the namespace to query, or null if querying for all<a name="line.3079"></a>
-<span class="sourceLineNo">3080</span>   * @param regex The regular expression to match against, or null if querying for all<a name="line.3080"></a>
-<span class="sourceLineNo">3081</span>   * @param tableNameList the list of table names, or null if querying for all<a name="line.3081"></a>
-<span class="sourceLineNo">3082</span>   * @param includeSysTables False to match only against userspace tables<a name="line.3082"></a>
-<span class="sourceLineNo">3083</span>   * @return the list of table descriptors<a name="line.3083"></a>
-<span class="sourceLineNo">3084</span>   */<a name="line.3084"></a>
-<span class="sourceLineNo">3085</span>  public List&lt;TableDescriptor&gt; listTableDescriptors(final String namespace, final String regex,<a name="line.3085"></a>
-<span class="sourceLineNo">3086</span>      final List&lt;TableName&gt; tableNameList, final boolean includeSysTables)<a name="line.3086"></a>
-<span class="sourceLineNo">3087</span>  throws IOException {<a name="line.3087"></a>
-<span class="sourceLineNo">3088</span>    List&lt;TableDescriptor&gt; htds = new ArrayList&lt;&gt;();<a name="line.3088"></a>
-<span class="sourceLineNo">3089</span>    if (cpHost != null) {<a name="line.3089"></a>
-<span class="sourceLineNo">3090</span>      cpHost.preGetTableDescriptors(tableNameList, htds, regex);<a name="line.3090"></a>
-<span class="sourceLineNo">3091</span>    }<a name="line.3091"></a>
-<span class="sourceLineNo">3092</span>    htds = getTableDescriptors(htds, namespace, regex, tableNameList, includeSysTables);<a name="line.3092"></a>
-<span class="sourceLineNo">3093</span>    if (cpHost != null) {<a name="line.3093"></a>
-<span class="sourceLineNo">3094</span>      cpHost.postGetTableDescriptors(tableNameList, htds, regex);<a name="line.3094"></a>
-<span class="sourceLineNo">3095</span>    }<a name="line.3095"></a>
-<span class="sourceLineNo">3096</span>    return htds;<a name="line.3096"></a>
-<span class="sourceLineNo">3097</span>  }<a name="line.3097"></a>
-<span class="sourceLineNo">3098</span><a name="line.3098"></a>
-<span class="sourceLineNo">3099</span>  /**<a name="line.3099"></a>
-<span class="sourceLineNo">3100</span>   * Returns the list of table names that match the specified request<a name="line.3100"></a>
-<span class="sourceLineNo">3101</span>   * @param regex The regular expression to match against, or null if querying for all<a name="line.3101"></a>
-<span class="sourceLineNo">3102</span>   * @param namespace the namespace to query, or null if querying for all<a name="line.3102"></a>
-<span class="sourceLineNo">3103</span>   * @param includeSysTables False to match only against userspace tables<a name="line.3103"></a>
-<span class="sourceLineNo">3104</span>   * @return the list of table names<a name="line.3104"></a>
-<span class="sourceLineNo">3105</span>   */<a name="line.3105"></a>
-<span class="sourceLineNo">3106</span>  public List&lt;TableName&gt; listTableNames(final String namespace, final String regex,<a name="line.3106"></a>
-<span class="sourceLineNo">3107</span>      final boolean includeSysTables) throws IOException {<a name="line.3107"></a>
-<span class="sourceLineNo">3108</span>    List&lt;TableDescriptor&gt; htds = new ArrayList&lt;&gt;();<a name="line.3108"></a>
-<span class="sourceLineNo">3109</span>    if (cpHost != null) {<a name="line.3109"></a>
-<span class="sourceLineNo">3110</span>      cpHost.preGetTableNames(htds, regex);<a name="line.3110"></a>
-<span class="sourceLineNo">3111</span>    }<a name="line.3111"></a>
-<span class="sourceLineNo">3112</span>    htds = getTableDescriptors(htds, namespace, regex, null, includeSysTables);<a name="line.3112"></a>
-<span class="sourceLineNo">3113</span>    if (cpHost != null) {<a name="line.3113"></a>
-<span class="sourceLineNo">3114</span>      cpHost.postGetTableNames(htds, regex);<a name="line.3114"></a>
-<span class="sourceLineNo">3115</span>    }<a name="line.3115"></a>
-<span class="sourceLineNo">3116</span>    List&lt;TableName&gt; result = new ArrayList&lt;&gt;(htds.size());<a name="line.3116"></a>
-<span class="sourceLineNo">3117</span>    for (TableDescriptor htd: htds) result.add(htd.getTableName());<a name="line.3117"></a>
-<span class="sourceLineNo">3118</span>    return result;<a name="line.3118"></a>
-<span class="sourceLineNo">3119</span>  }<a name="line.3119"></a>
-<span class="sourceLineNo">3120</span><a name="line.3120"></a>
-<span class="sourceLineNo">3121</span>  /**<a name="line.3121"></a>
-<span class="sourceLineNo">3122</span>   * @return list of table table descriptors after filtering by regex and whether to include system<a name="line.3122"></a>
-<span class="sourceLineNo">3123</span>   *    tables, etc.<a name="line.3123"></a>
-<span class="sourceLineNo">3124</span>   * @throws IOException<a name="line.3124"></a>
-<span class="sourceLineNo">3125</span>   */<a name="line.3125"></a>
-<span class="sourceLineNo">3126</span>  private List&lt;TableDescriptor&gt; getTableDescriptors(final List&lt;TableDescriptor&gt; htds,<a name="line.3126"></a>
-<span class="sourceLineNo">3127</span>      final String namespace, final String regex, final List&lt;TableName&gt; tableNameList,<a name="line.3127"></a>
-<span class="sourceLineNo">3128</span>      final boolean includeSysTables)<a name="line.3128"></a>
-<span class="sourceLineNo">3129</span>  throws IOException {<a name="line.3129"></a>
-<span class="sourceLineNo">3130</span>    if (tableNameList == null || tableNameList.isEmpty()) {<a name="line.3130"></a>
-<span class="sourceLineNo">3131</span>      // request for all TableDescriptors<a name="line.3131"></a>
-<span class="sourceLineNo">3132</span>      Collection&lt;TableDescriptor&gt; allHtds;<a name="line.3132"></a>
-<span class="sourceLineNo">3133</span>      if (namespace != null &amp;&amp; namespace.length() &gt; 0) {<a name="line.3133"></a>
-<span class="sourceLineNo">3134</span>        // Do a check on the namespace existence. Will fail if does not exist.<a name="line.3134"></a>
-<span class="sourceLineNo">3135</span>        this.clusterSchemaService.getNamespace(namespace);<a name="line.3135"></a>
-<span class="sourceLineNo">3136</span>        allHtds = tableDescriptors.getByNamespace(namespace).values();<a name="line.3136"></a>
-<span class="sourceLineNo">3137</span>      } else {<a name="line.3137"></a>
-<span class="sourceLineNo">3138</span>        allHtds = tableDescriptors.getAll().values();<a name="line.3138"></a>
-<span class="sourceLineNo">3139</span>      }<a name="line.3139"></a>
-<span class="sourceLineNo">3140</span>      for (TableDescriptor desc: allHtds) {<a name="line.3140"></a>
-<span class="sourceLineNo">3141</span>        if (tableStateManager.isTablePresent(desc.getTableName())<a name="line.3141"></a>
-<span class="sourceLineNo">3142</span>            &amp;&amp; (includeSysTables || !desc.getTableName().isSystemTable())) {<a name="line.3142"></a>
-<span class="sourceLineNo">3143</span>          htds.add(desc);<a name="line.3143"></a>
-<span class="sourceLineNo">3144</span>        }<a name="line.3144"></a>
-<span class="sourceLineNo">3145</span>      }<a name="line.3145"></a>
-<span class="sourceLineNo">3146</span>    } else {<a name="line.3146"></a>
-<span class="sourceLineNo">3147</span>      for (TableName s: tableNameList) {<a name="line.3147"></a>
-<span class="sourceLineNo">3148</span>        if (tableStateManager.isTablePresent(s)) {<a name="line.3148"></a>
-<span class="sourceLineNo">3149</span>          TableDescriptor desc = tableDescriptors.get(s);<a name="line.3149"></a>
-<span class="sourceLineNo">3150</span>          if (desc != null) {<a name="line.3150"></a>
-<span class="sourceLineNo">3151</span>            htds.add(desc);<a name="line.3151"></a>
-<span class="sourceLineNo">3152</span>          }<a name="line.3152"></a>
-<span class="sourceLineNo">3153</span>        }<a name="line.3153"></a>
-<span class="sourceLineNo">3154</span>      }<a name="line.3154"></a>
-<span class="sourceLineNo">3155</span>    }<a name="line.3155"></a>
-<span class="sourceLineNo">3156</span><a name="line.3156"></a>
-<span class="sourceLineNo">3157</span>    // Retains only those matched by regular expression.<a name="line.3157"></a>
-<span class="sourceLineNo">3158</span>    if (regex != null) filterTablesByRegex(htds, Pattern.compile(regex));<a name="line.3158"></a>
-<span class="sourceLineNo">3159</span>    return htds;<a name="line.3159"></a>
-<span class="sourceLineNo">3160</span>  }<a name="line.3160"></a>
-<span class="sourceLineNo">3161</span><a name="line.3161"></a>
-<span class="sourceLineNo">3162</span>  /**<a name="line.3162"></a>
-<span class="sourceLineNo">3163</span>   * Removes the table descriptors that don't match the pattern.<a name="line.3163"></a>
-<span class="sourceLineNo">3164</span>   * @param descriptors list of table descriptors to filter<a name="line.3164"></a>
-<span class="sourceLineNo">3165</span>   * @param pattern the regex to use<a name="line.3165"></a>
-<span class="sourceLineNo">3166</span>   */<a name="line.3166"></a>
-<span class="sourceLineNo">3167</span>  private static void filterTablesByRegex(final Collection&lt;TableDescriptor&gt; descriptors,<a name="line.3167"></a>
-<span class="sourceLineNo">3168</span>      final Pattern pattern) {<a name="line.3168"></a>
-<span class="sourceLineNo">3169</span>    final String defaultNS = NamespaceDescriptor.DEFAULT_NAMESPACE_NAME_STR;<a name="line.3169"></a>
-<span class="sourceLineNo">3170</span>    Iterator&lt;TableDescriptor&gt; itr = descriptors.iterator();<a name="line.3170"></a>
-<span class="sourceLineNo">3171</span>    while (itr.hasNext()) {<a name="line.3171"></a>
-<span class="sourceLineNo">3172</span>      TableDescriptor htd = itr.next();<a name="line.3172"></a>
-<span class="sourceLineNo">3173</span>      String tableName = htd.getTableName().getNameAsString();<a name="line.3173"></a>
-<span class="sourceLineNo">3174</span>      boolean matched = pattern.matcher(tableName).matches();<a name="line.3174"></a>
-<span class="sourceLineNo">3175</span>      if (!matched &amp;&amp; htd.getTableName().getNamespaceAsString().equals(defaultNS)) {<a name="line.3175"></a>
-<span class="sourceLineNo">3176</span>        matched = pattern.matcher(defaultNS + TableName.NAMESPACE_DELIM + tableName).matches();<a name="line.3176"></a>
-<span class="sourceLineNo">3177</span>      }<a name="line.3177"></a>
-<span class="sourceLineNo">3178</span>      if (!matched) {<a name="line.3178"></a>
-<span class="sourceLineNo">3179</span>        itr.remove();<a name="line.3179"></a>
-<span class="sourceLineNo">3180</span>      }<a name="line.3180"></a>
-<span class="sourceLineNo">3181</span>    }<a name="line.3181"></a>
-<span class="sourceLineNo">3182</span>  }<a name="line.3182"></a>
-<span class="sourceLineNo">3183</span><a name="line.3183"></a>
-<span class="sourceLineNo">3184</span>  @Override<a name="line.3184"></a>
-<span class="sourceLineNo">3185</span>  public long getLastMajorCompactionTimestamp(TableName table) throws IOException {<a name="line.3185"></a>
-<span class="sourceLineNo">3186</span>    return getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS))<a name="line.3186"></a>
-<span class="sourceLineNo">3187</span>        .getLastMajorCompactionTimestamp(table);<a name="line.3187"></a>
-<span class="sourceLineNo">3188</span>  }<a name="line.3188"></a>
-<span class="sourceLineNo">3189</span><a name="line.3189"></a>
-<span class="sourceLineNo">3190</span>  @Override<a name="line.3190"></a>
-<span class="sourceLineNo">3191</span>  public long getLastMajorCompactionTimestampForRegion(byte[] regionName) throws IOException {<a name="line.3191"></a>
-<span class="sourceLineNo">3192</span>    return getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS))<a name="line.3192"></a>
-<span class="sourceLineNo">3193</span>        .getLastMajorCompactionTimestamp(regionName);<a name="line.3193"></a>
-<span class="sourceLineNo">3194</span>  }<a name="line.3194"></a>
-<span class="sourceLineNo">3195</span><a name="line.3195"></a>
-<span class="sourceLineNo">3196</span>  /**<a name="line.3196"></a>
-<span class="sourceLineNo">3197</span>   * Gets the mob file compaction state for a specific table.<a name="line.3197"></a>
-<span class="sourceLineNo">3198</span>   * Whether all the mob files are selected is known during the compaction execution, but<a name="line.3198"></a>
-<span class="sourceLineNo">3199</span>   * the statistic is done just before compaction starts, it is hard to know the compaction<a name="line.3199"></a>
-<span class="sourceLineNo">3200</span>   * type at that time, so the rough statistics are chosen for the mob file compaction. Only two<a name="line.3200"></a>
-<span class="sourceLineNo">3201</span>   * compaction states are available, CompactionState.MAJOR_AND_MINOR and CompactionState.NONE.<a name="line.3201"></a>
-<span class="sourceLineNo">3202</span>   * @param tableName The current table name.<a name="line.3202"></a>
-<span class="sourceLineNo">3203</span>   * @return If a given table is in mob file compaction now.<a name="line.3203"></a>
-<span class="sourceLineNo">3204</span>   */<a name="line.3204"></a>
-<span class="sourceLineNo">3205</span>  public CompactionState getMobCompactionState(TableName tableName) {<a name="line.3205"></a>
-<span class="sourceLineNo">3206</span>    AtomicInteger compactionsCount = mobCompactionStates.get(tableName);<a name="line.3206"></a>
-<span class="sourceLineNo">3207</span>    if (compactionsCount != null &amp;&amp; compactionsCount.get() != 0) {<a name="line.3207"></a>
-<span class="sourceLineNo">3208</span>      return CompactionState.MAJOR_AND_MINOR;<a name="line.3208"></a>
-<span class="sourceLineNo">3209</span>    }<a name="line.3209"></a>
-<span class="sourceLineNo">3210</span>    return CompactionState.NONE;<a name="line.3210"></a>
-<span class="sourceLineNo">3211</span>  }<a name="line.3211"></a>
-<span class="sourceLineNo">3212</span><a name="line.3212"></a>
-<span class="sourceLineNo">3213</span>  public void reportMobCompactionStart(TableName tableName) throws IOException {<a name="line.3213"></a>
-<span class="sourceLineNo">3214</span>    IdLock.Entry lockEntry = null;<a name="line.3214"></a>
-<span class="sourceLineNo">3215</span>    try {<a name="line.3215"></a>
-<span class="sourceLineNo">3216</span>      lockEntry = mobCompactionLock.getLockEntry(tableName.hashCode());<a name="line.3216"></a>
-<span class="sourceLineNo">3217</span>      AtomicInteger compactionsCount = mobCompactionStates.get(tableName);<a name="line.3217"></a>
-<span class="sourceLineNo">3218</span>      if (compactionsCount == null) {<a name="line.3218"></a>
-<span class="sourceLineNo">3219</span>        compactionsCount = new AtomicInteger(0);<a name="line.3219"></a>
-<span class="sourceLineNo">3220</span>        mobCompactionStates.put(tableName, compactionsCount);<a name="line.3220"></a>
-<span class="sourceLineNo">3221</span>      }<a name="line.3221"></a>
-<span class="sourceLineNo">3222</span>      compactionsCount.incrementAndGet();<a name="line.3222"></a>
-<span class="sourceLineNo">3223</span>    } finally {<a name="line.3223"></a>
-<span class="sourceLineNo">3224</span>      if (lockEntry != null) {<a name="line.3224"></a>
-<span class="sourceLineNo">3225</span>        mobCompactionLock.releaseLockEntry(lockEntry);<a name="line.3225"></a>
-<span class="sourceLineNo">3226</span>      }<a name="line.3226"></a>
-<span class="sourceLineNo">3227</span>    }<a name="line.3227"></a>
-<span class="sourceLineNo">3228</span>  }<a name="line.3228"></a>
-<span class="sourceLineNo">3229</span><a name="line.3229"></a>
-<span class="sourceLineNo">3230</span>  public void reportMobCompactionEnd(TableName tableName) throws IOException {<a name="line.3230"></a>
-<span class="sourceLineNo">3231</span>    IdLock.Entry lockEntry = null;<a name="line.3231"></a>
-<span class="sourceLineNo">3232</span>    try {<a name="line.3232"></a>
-<span class="sourceLineNo">3233</span>      lockEntry = mobCompactionLock.getLockEntry(tableName.hashCode());<a name="line.3233"></a>
-<span class="sourceLineNo">3234</span>      AtomicInteger compactionsCount = mobCompactionStates.get(tableName);<a name="line.3234"></a>
-<span class="sourceLineNo">3235</span>      if (compactionsCount != null) {<a name="line.3235"></a>
-<span class="sourceLineNo">3236</span>        int count = compactionsCount.decrementAndGet();<a name="line.3236"></a>
-<span class="sourceLineNo">3237</span>        // remove the entry if the count is 0.<a name="line.3237"></a>
-<span class="sourceLineNo">3238</span>        if (count == 0) {<a name="line.3238"></a>
-<span class="sourceLineNo">3239</span>          mobCompactionStates.remove(tableName);<a name="line.3239"></a>
-<span class="sourceLineNo">3240</span>        }<a name="line.3240"></a>
-<span class="sourceLineNo">3241</span>      }<a

<TRUNCATED>

Mime
View raw message