hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From git-site-r...@apache.org
Subject [27/51] [partial] hbase-site git commit: Published site at 82d554e3783372cc6b05489452c815b57c06f6cd.
Date Fri, 12 May 2017 15:00:01 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/709b8fcc/devapidocs/src-html/org/apache/hadoop/hbase/client/HBaseAdmin.AbortProcedureFuture.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/client/HBaseAdmin.AbortProcedureFuture.html b/devapidocs/src-html/org/apache/hadoop/hbase/client/HBaseAdmin.AbortProcedureFuture.html
index f2c44db..6cf2fc8 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/client/HBaseAdmin.AbortProcedureFuture.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/client/HBaseAdmin.AbortProcedureFuture.html
@@ -2581,7 +2581,7 @@
 <span class="sourceLineNo">2573</span>    try {<a name="line.2573"></a>
 <span class="sourceLineNo">2574</span>      // Restore snapshot<a name="line.2574"></a>
 <span class="sourceLineNo">2575</span>      get(<a name="line.2575"></a>
-<span class="sourceLineNo">2576</span>        internalRestoreSnapshotAsync(snapshotName, tableName, false),<a name="line.2576"></a>
+<span class="sourceLineNo">2576</span>        internalRestoreSnapshotAsync(snapshotName, tableName),<a name="line.2576"></a>
 <span class="sourceLineNo">2577</span>        syncWaitTimeout,<a name="line.2577"></a>
 <span class="sourceLineNo">2578</span>        TimeUnit.MILLISECONDS);<a name="line.2578"></a>
 <span class="sourceLineNo">2579</span>    } catch (IOException e) {<a name="line.2579"></a>
@@ -2590,7 +2590,7 @@
 <span class="sourceLineNo">2582</span>      if (takeFailSafeSnapshot) {<a name="line.2582"></a>
 <span class="sourceLineNo">2583</span>        try {<a name="line.2583"></a>
 <span class="sourceLineNo">2584</span>          get(<a name="line.2584"></a>
-<span class="sourceLineNo">2585</span>            internalRestoreSnapshotAsync(failSafeSnapshotSnapshotName, tableName, false),<a name="line.2585"></a>
+<span class="sourceLineNo">2585</span>            internalRestoreSnapshotAsync(failSafeSnapshotSnapshotName, tableName),<a name="line.2585"></a>
 <span class="sourceLineNo">2586</span>            syncWaitTimeout,<a name="line.2586"></a>
 <span class="sourceLineNo">2587</span>            TimeUnit.MILLISECONDS);<a name="line.2587"></a>
 <span class="sourceLineNo">2588</span>          String msg = "Restore snapshot=" + snapshotName +<a name="line.2588"></a>
@@ -2633,7 +2633,7 @@
 <span class="sourceLineNo">2625</span>      throw new TableNotDisabledException(tableName);<a name="line.2625"></a>
 <span class="sourceLineNo">2626</span>    }<a name="line.2626"></a>
 <span class="sourceLineNo">2627</span><a name="line.2627"></a>
-<span class="sourceLineNo">2628</span>    return internalRestoreSnapshotAsync(snapshotName, tableName, false);<a name="line.2628"></a>
+<span class="sourceLineNo">2628</span>    return internalRestoreSnapshotAsync(snapshotName, tableName);<a name="line.2628"></a>
 <span class="sourceLineNo">2629</span>  }<a name="line.2629"></a>
 <span class="sourceLineNo">2630</span><a name="line.2630"></a>
 <span class="sourceLineNo">2631</span>  @Override<a name="line.2631"></a>
@@ -2643,1621 +2643,1614 @@
 <span class="sourceLineNo">2635</span>  }<a name="line.2635"></a>
 <span class="sourceLineNo">2636</span><a name="line.2636"></a>
 <span class="sourceLineNo">2637</span>  @Override<a name="line.2637"></a>
-<span class="sourceLineNo">2638</span>  public void cloneSnapshot(String snapshotName, TableName tableName, boolean restoreAcl)<a name="line.2638"></a>
+<span class="sourceLineNo">2638</span>  public void cloneSnapshot(final String snapshotName, final TableName tableName)<a name="line.2638"></a>
 <span class="sourceLineNo">2639</span>      throws IOException, TableExistsException, RestoreSnapshotException {<a name="line.2639"></a>
 <span class="sourceLineNo">2640</span>    if (tableExists(tableName)) {<a name="line.2640"></a>
 <span class="sourceLineNo">2641</span>      throw new TableExistsException(tableName);<a name="line.2641"></a>
 <span class="sourceLineNo">2642</span>    }<a name="line.2642"></a>
 <span class="sourceLineNo">2643</span>    get(<a name="line.2643"></a>
-<span class="sourceLineNo">2644</span>      internalRestoreSnapshotAsync(snapshotName, tableName, restoreAcl),<a name="line.2644"></a>
+<span class="sourceLineNo">2644</span>      internalRestoreSnapshotAsync(snapshotName, tableName),<a name="line.2644"></a>
 <span class="sourceLineNo">2645</span>      Integer.MAX_VALUE,<a name="line.2645"></a>
 <span class="sourceLineNo">2646</span>      TimeUnit.MILLISECONDS);<a name="line.2646"></a>
 <span class="sourceLineNo">2647</span>  }<a name="line.2647"></a>
 <span class="sourceLineNo">2648</span><a name="line.2648"></a>
 <span class="sourceLineNo">2649</span>  @Override<a name="line.2649"></a>
-<span class="sourceLineNo">2650</span>  public void cloneSnapshot(final String snapshotName, final TableName tableName)<a name="line.2650"></a>
-<span class="sourceLineNo">2651</span>      throws IOException, TableExistsException, RestoreSnapshotException {<a name="line.2651"></a>
-<span class="sourceLineNo">2652</span>    cloneSnapshot(snapshotName, tableName, false);<a name="line.2652"></a>
-<span class="sourceLineNo">2653</span>  }<a name="line.2653"></a>
-<span class="sourceLineNo">2654</span><a name="line.2654"></a>
-<span class="sourceLineNo">2655</span>  @Override<a name="line.2655"></a>
-<span class="sourceLineNo">2656</span>  public Future&lt;Void&gt; cloneSnapshotAsync(final String snapshotName, final TableName tableName)<a name="line.2656"></a>
-<span class="sourceLineNo">2657</span>      throws IOException, TableExistsException {<a name="line.2657"></a>
-<span class="sourceLineNo">2658</span>    if (tableExists(tableName)) {<a name="line.2658"></a>
-<span class="sourceLineNo">2659</span>      throw new TableExistsException(tableName);<a name="line.2659"></a>
-<span class="sourceLineNo">2660</span>    }<a name="line.2660"></a>
-<span class="sourceLineNo">2661</span>    return internalRestoreSnapshotAsync(snapshotName, tableName, false);<a name="line.2661"></a>
-<span class="sourceLineNo">2662</span>  }<a name="line.2662"></a>
-<span class="sourceLineNo">2663</span><a name="line.2663"></a>
-<span class="sourceLineNo">2664</span>  @Override<a name="line.2664"></a>
-<span class="sourceLineNo">2665</span>  public byte[] execProcedureWithRet(String signature, String instance, Map&lt;String, String&gt; props)<a name="line.2665"></a>
-<span class="sourceLineNo">2666</span>      throws IOException {<a name="line.2666"></a>
-<span class="sourceLineNo">2667</span>    ProcedureDescription desc = ProtobufUtil.buildProcedureDescription(signature, instance, props);<a name="line.2667"></a>
-<span class="sourceLineNo">2668</span>    final ExecProcedureRequest request =<a name="line.2668"></a>
-<span class="sourceLineNo">2669</span>        ExecProcedureRequest.newBuilder().setProcedure(desc).build();<a name="line.2669"></a>
-<span class="sourceLineNo">2670</span>    // run the procedure on the master<a name="line.2670"></a>
-<span class="sourceLineNo">2671</span>    ExecProcedureResponse response = executeCallable(<a name="line.2671"></a>
-<span class="sourceLineNo">2672</span>      new MasterCallable&lt;ExecProcedureResponse&gt;(getConnection(), getRpcControllerFactory()) {<a name="line.2672"></a>
-<span class="sourceLineNo">2673</span>        @Override<a name="line.2673"></a>
-<span class="sourceLineNo">2674</span>        protected ExecProcedureResponse rpcCall() throws Exception {<a name="line.2674"></a>
-<span class="sourceLineNo">2675</span>          return master.execProcedureWithRet(getRpcController(), request);<a name="line.2675"></a>
-<span class="sourceLineNo">2676</span>        }<a name="line.2676"></a>
-<span class="sourceLineNo">2677</span>      });<a name="line.2677"></a>
-<span class="sourceLineNo">2678</span><a name="line.2678"></a>
-<span class="sourceLineNo">2679</span>    return response.hasReturnData() ? response.getReturnData().toByteArray() : null;<a name="line.2679"></a>
-<span class="sourceLineNo">2680</span>  }<a name="line.2680"></a>
-<span class="sourceLineNo">2681</span><a name="line.2681"></a>
-<span class="sourceLineNo">2682</span>  @Override<a name="line.2682"></a>
-<span class="sourceLineNo">2683</span>  public void execProcedure(String signature, String instance, Map&lt;String, String&gt; props)<a name="line.2683"></a>
-<span class="sourceLineNo">2684</span>      throws IOException {<a name="line.2684"></a>
-<span class="sourceLineNo">2685</span>    ProcedureDescription desc = ProtobufUtil.buildProcedureDescription(signature, instance, props);<a name="line.2685"></a>
-<span class="sourceLineNo">2686</span>    final ExecProcedureRequest request =<a name="line.2686"></a>
-<span class="sourceLineNo">2687</span>        ExecProcedureRequest.newBuilder().setProcedure(desc).build();<a name="line.2687"></a>
-<span class="sourceLineNo">2688</span>    // run the procedure on the master<a name="line.2688"></a>
-<span class="sourceLineNo">2689</span>    ExecProcedureResponse response = executeCallable(new MasterCallable&lt;ExecProcedureResponse&gt;(<a name="line.2689"></a>
-<span class="sourceLineNo">2690</span>        getConnection(), getRpcControllerFactory()) {<a name="line.2690"></a>
-<span class="sourceLineNo">2691</span>      @Override<a name="line.2691"></a>
-<span class="sourceLineNo">2692</span>      protected ExecProcedureResponse rpcCall() throws Exception {<a name="line.2692"></a>
-<span class="sourceLineNo">2693</span>        return master.execProcedure(getRpcController(), request);<a name="line.2693"></a>
-<span class="sourceLineNo">2694</span>      }<a name="line.2694"></a>
-<span class="sourceLineNo">2695</span>    });<a name="line.2695"></a>
-<span class="sourceLineNo">2696</span><a name="line.2696"></a>
-<span class="sourceLineNo">2697</span>    long start = EnvironmentEdgeManager.currentTime();<a name="line.2697"></a>
-<span class="sourceLineNo">2698</span>    long max = response.getExpectedTimeout();<a name="line.2698"></a>
-<span class="sourceLineNo">2699</span>    long maxPauseTime = max / this.numRetries;<a name="line.2699"></a>
-<span class="sourceLineNo">2700</span>    int tries = 0;<a name="line.2700"></a>
-<span class="sourceLineNo">2701</span>    LOG.debug("Waiting a max of " + max + " ms for procedure '" +<a name="line.2701"></a>
-<span class="sourceLineNo">2702</span>        signature + " : " + instance + "'' to complete. (max " + maxPauseTime + " ms per retry)");<a name="line.2702"></a>
-<span class="sourceLineNo">2703</span>    boolean done = false;<a name="line.2703"></a>
-<span class="sourceLineNo">2704</span>    while (tries == 0<a name="line.2704"></a>
-<span class="sourceLineNo">2705</span>        || ((EnvironmentEdgeManager.currentTime() - start) &lt; max &amp;&amp; !done)) {<a name="line.2705"></a>
-<span class="sourceLineNo">2706</span>      try {<a name="line.2706"></a>
-<span class="sourceLineNo">2707</span>        // sleep a backoff &lt;= pauseTime amount<a name="line.2707"></a>
-<span class="sourceLineNo">2708</span>        long sleep = getPauseTime(tries++);<a name="line.2708"></a>
-<span class="sourceLineNo">2709</span>        sleep = sleep &gt; maxPauseTime ? maxPauseTime : sleep;<a name="line.2709"></a>
-<span class="sourceLineNo">2710</span>        LOG.debug("(#" + tries + ") Sleeping: " + sleep +<a name="line.2710"></a>
-<span class="sourceLineNo">2711</span>          "ms while waiting for procedure completion.");<a name="line.2711"></a>
-<span class="sourceLineNo">2712</span>        Thread.sleep(sleep);<a name="line.2712"></a>
-<span class="sourceLineNo">2713</span>      } catch (InterruptedException e) {<a name="line.2713"></a>
-<span class="sourceLineNo">2714</span>        throw (InterruptedIOException)new InterruptedIOException("Interrupted").initCause(e);<a name="line.2714"></a>
-<span class="sourceLineNo">2715</span>      }<a name="line.2715"></a>
-<span class="sourceLineNo">2716</span>      LOG.debug("Getting current status of procedure from master...");<a name="line.2716"></a>
-<span class="sourceLineNo">2717</span>      done = isProcedureFinished(signature, instance, props);<a name="line.2717"></a>
-<span class="sourceLineNo">2718</span>    }<a name="line.2718"></a>
-<span class="sourceLineNo">2719</span>    if (!done) {<a name="line.2719"></a>
-<span class="sourceLineNo">2720</span>      throw new IOException("Procedure '" + signature + " : " + instance<a name="line.2720"></a>
-<span class="sourceLineNo">2721</span>          + "' wasn't completed in expectedTime:" + max + " ms");<a name="line.2721"></a>
-<span class="sourceLineNo">2722</span>    }<a name="line.2722"></a>
-<span class="sourceLineNo">2723</span>  }<a name="line.2723"></a>
-<span class="sourceLineNo">2724</span><a name="line.2724"></a>
-<span class="sourceLineNo">2725</span>  @Override<a name="line.2725"></a>
-<span class="sourceLineNo">2726</span>  public boolean isProcedureFinished(String signature, String instance, Map&lt;String, String&gt; props)<a name="line.2726"></a>
-<span class="sourceLineNo">2727</span>      throws IOException {<a name="line.2727"></a>
-<span class="sourceLineNo">2728</span>    ProcedureDescription desc = ProtobufUtil.buildProcedureDescription(signature, instance, props);<a name="line.2728"></a>
-<span class="sourceLineNo">2729</span>    return executeCallable(<a name="line.2729"></a>
-<span class="sourceLineNo">2730</span>      new MasterCallable&lt;IsProcedureDoneResponse&gt;(getConnection(), getRpcControllerFactory()) {<a name="line.2730"></a>
-<span class="sourceLineNo">2731</span>        @Override<a name="line.2731"></a>
-<span class="sourceLineNo">2732</span>        protected IsProcedureDoneResponse rpcCall() throws Exception {<a name="line.2732"></a>
-<span class="sourceLineNo">2733</span>          return master.isProcedureDone(getRpcController(),<a name="line.2733"></a>
-<span class="sourceLineNo">2734</span>            IsProcedureDoneRequest.newBuilder().setProcedure(desc).build());<a name="line.2734"></a>
-<span class="sourceLineNo">2735</span>        }<a name="line.2735"></a>
-<span class="sourceLineNo">2736</span>      }).getDone();<a name="line.2736"></a>
-<span class="sourceLineNo">2737</span>  }<a name="line.2737"></a>
-<span class="sourceLineNo">2738</span><a name="line.2738"></a>
-<span class="sourceLineNo">2739</span>  /**<a name="line.2739"></a>
-<span class="sourceLineNo">2740</span>   * Execute Restore/Clone snapshot and wait for the server to complete (blocking).<a name="line.2740"></a>
-<span class="sourceLineNo">2741</span>   * To check if the cloned table exists, use {@link #isTableAvailable} -- it is not safe to<a name="line.2741"></a>
-<span class="sourceLineNo">2742</span>   * create an HTable instance to this table before it is available.<a name="line.2742"></a>
-<span class="sourceLineNo">2743</span>   * @param snapshotName snapshot to restore<a name="line.2743"></a>
-<span class="sourceLineNo">2744</span>   * @param tableName table name to restore the snapshot on<a name="line.2744"></a>
-<span class="sourceLineNo">2745</span>   * @throws IOException if a remote or network exception occurs<a name="line.2745"></a>
-<span class="sourceLineNo">2746</span>   * @throws RestoreSnapshotException if snapshot failed to be restored<a name="line.2746"></a>
-<span class="sourceLineNo">2747</span>   * @throws IllegalArgumentException if the restore request is formatted incorrectly<a name="line.2747"></a>
-<span class="sourceLineNo">2748</span>   */<a name="line.2748"></a>
-<span class="sourceLineNo">2749</span>  private Future&lt;Void&gt; internalRestoreSnapshotAsync(final String snapshotName,<a name="line.2749"></a>
-<span class="sourceLineNo">2750</span>      final TableName tableName, final boolean restoreAcl)<a name="line.2750"></a>
-<span class="sourceLineNo">2751</span>      throws IOException, RestoreSnapshotException {<a name="line.2751"></a>
-<span class="sourceLineNo">2752</span>    final HBaseProtos.SnapshotDescription snapshot = HBaseProtos.SnapshotDescription.newBuilder()<a name="line.2752"></a>
-<span class="sourceLineNo">2753</span>        .setName(snapshotName).setTable(tableName.getNameAsString()).build();<a name="line.2753"></a>
-<span class="sourceLineNo">2754</span><a name="line.2754"></a>
-<span class="sourceLineNo">2755</span>    // actually restore the snapshot<a name="line.2755"></a>
-<span class="sourceLineNo">2756</span>    ClientSnapshotDescriptionUtils.assertSnapshotRequestIsValid(snapshot);<a name="line.2756"></a>
-<span class="sourceLineNo">2757</span><a name="line.2757"></a>
-<span class="sourceLineNo">2758</span>    RestoreSnapshotResponse response = executeCallable(<a name="line.2758"></a>
-<span class="sourceLineNo">2759</span>        new MasterCallable&lt;RestoreSnapshotResponse&gt;(getConnection(), getRpcControllerFactory()) {<a name="line.2759"></a>
-<span class="sourceLineNo">2760</span>      @Override<a name="line.2760"></a>
-<span class="sourceLineNo">2761</span>      protected RestoreSnapshotResponse rpcCall() throws Exception {<a name="line.2761"></a>
-<span class="sourceLineNo">2762</span>        final RestoreSnapshotRequest request = RestoreSnapshotRequest.newBuilder()<a name="line.2762"></a>
-<span class="sourceLineNo">2763</span>            .setSnapshot(snapshot)<a name="line.2763"></a>
-<span class="sourceLineNo">2764</span>            .setNonceGroup(ng.getNonceGroup())<a name="line.2764"></a>
-<span class="sourceLineNo">2765</span>            .setNonce(ng.newNonce())<a name="line.2765"></a>
-<span class="sourceLineNo">2766</span>            .setRestoreACL(restoreAcl)<a name="line.2766"></a>
-<span class="sourceLineNo">2767</span>            .build();<a name="line.2767"></a>
-<span class="sourceLineNo">2768</span>        return master.restoreSnapshot(getRpcController(), request);<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><a name="line.2771"></a>
-<span class="sourceLineNo">2772</span>    return new RestoreSnapshotFuture(this, snapshot, tableName, response);<a name="line.2772"></a>
-<span class="sourceLineNo">2773</span>  }<a name="line.2773"></a>
-<span class="sourceLineNo">2774</span><a name="line.2774"></a>
-<span class="sourceLineNo">2775</span>  private static class RestoreSnapshotFuture extends TableFuture&lt;Void&gt; {<a name="line.2775"></a>
-<span class="sourceLineNo">2776</span>    public RestoreSnapshotFuture(<a name="line.2776"></a>
-<span class="sourceLineNo">2777</span>        final HBaseAdmin admin,<a name="line.2777"></a>
-<span class="sourceLineNo">2778</span>        final HBaseProtos.SnapshotDescription snapshot,<a name="line.2778"></a>
-<span class="sourceLineNo">2779</span>        final TableName tableName,<a name="line.2779"></a>
-<span class="sourceLineNo">2780</span>        final RestoreSnapshotResponse response) {<a name="line.2780"></a>
-<span class="sourceLineNo">2781</span>      super(admin, tableName,<a name="line.2781"></a>
-<span class="sourceLineNo">2782</span>          (response != null &amp;&amp; response.hasProcId()) ? response.getProcId() : null);<a name="line.2782"></a>
-<span class="sourceLineNo">2783</span><a name="line.2783"></a>
-<span class="sourceLineNo">2784</span>      if (response != null &amp;&amp; !response.hasProcId()) {<a name="line.2784"></a>
-<span class="sourceLineNo">2785</span>        throw new UnsupportedOperationException("Client could not call old version of Server");<a name="line.2785"></a>
-<span class="sourceLineNo">2786</span>      }<a name="line.2786"></a>
+<span class="sourceLineNo">2650</span>  public Future&lt;Void&gt; cloneSnapshotAsync(final String snapshotName, final TableName tableName)<a name="line.2650"></a>
+<span class="sourceLineNo">2651</span>      throws IOException, TableExistsException {<a name="line.2651"></a>
+<span class="sourceLineNo">2652</span>    if (tableExists(tableName)) {<a name="line.2652"></a>
+<span class="sourceLineNo">2653</span>      throw new TableExistsException(tableName);<a name="line.2653"></a>
+<span class="sourceLineNo">2654</span>    }<a name="line.2654"></a>
+<span class="sourceLineNo">2655</span>    return internalRestoreSnapshotAsync(snapshotName, tableName);<a name="line.2655"></a>
+<span class="sourceLineNo">2656</span>  }<a name="line.2656"></a>
+<span class="sourceLineNo">2657</span><a name="line.2657"></a>
+<span class="sourceLineNo">2658</span>  @Override<a name="line.2658"></a>
+<span class="sourceLineNo">2659</span>  public byte[] execProcedureWithRet(String signature, String instance, Map&lt;String, String&gt; props)<a name="line.2659"></a>
+<span class="sourceLineNo">2660</span>      throws IOException {<a name="line.2660"></a>
+<span class="sourceLineNo">2661</span>    ProcedureDescription desc = ProtobufUtil.buildProcedureDescription(signature, instance, props);<a name="line.2661"></a>
+<span class="sourceLineNo">2662</span>    final ExecProcedureRequest request =<a name="line.2662"></a>
+<span class="sourceLineNo">2663</span>        ExecProcedureRequest.newBuilder().setProcedure(desc).build();<a name="line.2663"></a>
+<span class="sourceLineNo">2664</span>    // run the procedure on the master<a name="line.2664"></a>
+<span class="sourceLineNo">2665</span>    ExecProcedureResponse response = executeCallable(<a name="line.2665"></a>
+<span class="sourceLineNo">2666</span>      new MasterCallable&lt;ExecProcedureResponse&gt;(getConnection(), getRpcControllerFactory()) {<a name="line.2666"></a>
+<span class="sourceLineNo">2667</span>        @Override<a name="line.2667"></a>
+<span class="sourceLineNo">2668</span>        protected ExecProcedureResponse rpcCall() throws Exception {<a name="line.2668"></a>
+<span class="sourceLineNo">2669</span>          return master.execProcedureWithRet(getRpcController(), request);<a name="line.2669"></a>
+<span class="sourceLineNo">2670</span>        }<a name="line.2670"></a>
+<span class="sourceLineNo">2671</span>      });<a name="line.2671"></a>
+<span class="sourceLineNo">2672</span><a name="line.2672"></a>
+<span class="sourceLineNo">2673</span>    return response.hasReturnData() ? response.getReturnData().toByteArray() : null;<a name="line.2673"></a>
+<span class="sourceLineNo">2674</span>  }<a name="line.2674"></a>
+<span class="sourceLineNo">2675</span><a name="line.2675"></a>
+<span class="sourceLineNo">2676</span>  @Override<a name="line.2676"></a>
+<span class="sourceLineNo">2677</span>  public void execProcedure(String signature, String instance, Map&lt;String, String&gt; props)<a name="line.2677"></a>
+<span class="sourceLineNo">2678</span>      throws IOException {<a name="line.2678"></a>
+<span class="sourceLineNo">2679</span>    ProcedureDescription desc = ProtobufUtil.buildProcedureDescription(signature, instance, props);<a name="line.2679"></a>
+<span class="sourceLineNo">2680</span>    final ExecProcedureRequest request =<a name="line.2680"></a>
+<span class="sourceLineNo">2681</span>        ExecProcedureRequest.newBuilder().setProcedure(desc).build();<a name="line.2681"></a>
+<span class="sourceLineNo">2682</span>    // run the procedure on the master<a name="line.2682"></a>
+<span class="sourceLineNo">2683</span>    ExecProcedureResponse response = executeCallable(new MasterCallable&lt;ExecProcedureResponse&gt;(<a name="line.2683"></a>
+<span class="sourceLineNo">2684</span>        getConnection(), getRpcControllerFactory()) {<a name="line.2684"></a>
+<span class="sourceLineNo">2685</span>      @Override<a name="line.2685"></a>
+<span class="sourceLineNo">2686</span>      protected ExecProcedureResponse rpcCall() throws Exception {<a name="line.2686"></a>
+<span class="sourceLineNo">2687</span>        return master.execProcedure(getRpcController(), request);<a name="line.2687"></a>
+<span class="sourceLineNo">2688</span>      }<a name="line.2688"></a>
+<span class="sourceLineNo">2689</span>    });<a name="line.2689"></a>
+<span class="sourceLineNo">2690</span><a name="line.2690"></a>
+<span class="sourceLineNo">2691</span>    long start = EnvironmentEdgeManager.currentTime();<a name="line.2691"></a>
+<span class="sourceLineNo">2692</span>    long max = response.getExpectedTimeout();<a name="line.2692"></a>
+<span class="sourceLineNo">2693</span>    long maxPauseTime = max / this.numRetries;<a name="line.2693"></a>
+<span class="sourceLineNo">2694</span>    int tries = 0;<a name="line.2694"></a>
+<span class="sourceLineNo">2695</span>    LOG.debug("Waiting a max of " + max + " ms for procedure '" +<a name="line.2695"></a>
+<span class="sourceLineNo">2696</span>        signature + " : " + instance + "'' to complete. (max " + maxPauseTime + " ms per retry)");<a name="line.2696"></a>
+<span class="sourceLineNo">2697</span>    boolean done = false;<a name="line.2697"></a>
+<span class="sourceLineNo">2698</span>    while (tries == 0<a name="line.2698"></a>
+<span class="sourceLineNo">2699</span>        || ((EnvironmentEdgeManager.currentTime() - start) &lt; max &amp;&amp; !done)) {<a name="line.2699"></a>
+<span class="sourceLineNo">2700</span>      try {<a name="line.2700"></a>
+<span class="sourceLineNo">2701</span>        // sleep a backoff &lt;= pauseTime amount<a name="line.2701"></a>
+<span class="sourceLineNo">2702</span>        long sleep = getPauseTime(tries++);<a name="line.2702"></a>
+<span class="sourceLineNo">2703</span>        sleep = sleep &gt; maxPauseTime ? maxPauseTime : sleep;<a name="line.2703"></a>
+<span class="sourceLineNo">2704</span>        LOG.debug("(#" + tries + ") Sleeping: " + sleep +<a name="line.2704"></a>
+<span class="sourceLineNo">2705</span>          "ms while waiting for procedure completion.");<a name="line.2705"></a>
+<span class="sourceLineNo">2706</span>        Thread.sleep(sleep);<a name="line.2706"></a>
+<span class="sourceLineNo">2707</span>      } catch (InterruptedException e) {<a name="line.2707"></a>
+<span class="sourceLineNo">2708</span>        throw (InterruptedIOException)new InterruptedIOException("Interrupted").initCause(e);<a name="line.2708"></a>
+<span class="sourceLineNo">2709</span>      }<a name="line.2709"></a>
+<span class="sourceLineNo">2710</span>      LOG.debug("Getting current status of procedure from master...");<a name="line.2710"></a>
+<span class="sourceLineNo">2711</span>      done = isProcedureFinished(signature, instance, props);<a name="line.2711"></a>
+<span class="sourceLineNo">2712</span>    }<a name="line.2712"></a>
+<span class="sourceLineNo">2713</span>    if (!done) {<a name="line.2713"></a>
+<span class="sourceLineNo">2714</span>      throw new IOException("Procedure '" + signature + " : " + instance<a name="line.2714"></a>
+<span class="sourceLineNo">2715</span>          + "' wasn't completed in expectedTime:" + max + " ms");<a name="line.2715"></a>
+<span class="sourceLineNo">2716</span>    }<a name="line.2716"></a>
+<span class="sourceLineNo">2717</span>  }<a name="line.2717"></a>
+<span class="sourceLineNo">2718</span><a name="line.2718"></a>
+<span class="sourceLineNo">2719</span>  @Override<a name="line.2719"></a>
+<span class="sourceLineNo">2720</span>  public boolean isProcedureFinished(String signature, String instance, Map&lt;String, String&gt; props)<a name="line.2720"></a>
+<span class="sourceLineNo">2721</span>      throws IOException {<a name="line.2721"></a>
+<span class="sourceLineNo">2722</span>    ProcedureDescription desc = ProtobufUtil.buildProcedureDescription(signature, instance, props);<a name="line.2722"></a>
+<span class="sourceLineNo">2723</span>    return executeCallable(<a name="line.2723"></a>
+<span class="sourceLineNo">2724</span>      new MasterCallable&lt;IsProcedureDoneResponse&gt;(getConnection(), getRpcControllerFactory()) {<a name="line.2724"></a>
+<span class="sourceLineNo">2725</span>        @Override<a name="line.2725"></a>
+<span class="sourceLineNo">2726</span>        protected IsProcedureDoneResponse rpcCall() throws Exception {<a name="line.2726"></a>
+<span class="sourceLineNo">2727</span>          return master.isProcedureDone(getRpcController(),<a name="line.2727"></a>
+<span class="sourceLineNo">2728</span>            IsProcedureDoneRequest.newBuilder().setProcedure(desc).build());<a name="line.2728"></a>
+<span class="sourceLineNo">2729</span>        }<a name="line.2729"></a>
+<span class="sourceLineNo">2730</span>      }).getDone();<a name="line.2730"></a>
+<span class="sourceLineNo">2731</span>  }<a name="line.2731"></a>
+<span class="sourceLineNo">2732</span><a name="line.2732"></a>
+<span class="sourceLineNo">2733</span>  /**<a name="line.2733"></a>
+<span class="sourceLineNo">2734</span>   * Execute Restore/Clone snapshot and wait for the server to complete (blocking).<a name="line.2734"></a>
+<span class="sourceLineNo">2735</span>   * To check if the cloned table exists, use {@link #isTableAvailable} -- it is not safe to<a name="line.2735"></a>
+<span class="sourceLineNo">2736</span>   * create an HTable instance to this table before it is available.<a name="line.2736"></a>
+<span class="sourceLineNo">2737</span>   * @param snapshotName snapshot to restore<a name="line.2737"></a>
+<span class="sourceLineNo">2738</span>   * @param tableName table name to restore the snapshot on<a name="line.2738"></a>
+<span class="sourceLineNo">2739</span>   * @throws IOException if a remote or network exception occurs<a name="line.2739"></a>
+<span class="sourceLineNo">2740</span>   * @throws RestoreSnapshotException if snapshot failed to be restored<a name="line.2740"></a>
+<span class="sourceLineNo">2741</span>   * @throws IllegalArgumentException if the restore request is formatted incorrectly<a name="line.2741"></a>
+<span class="sourceLineNo">2742</span>   */<a name="line.2742"></a>
+<span class="sourceLineNo">2743</span>  private Future&lt;Void&gt; internalRestoreSnapshotAsync(<a name="line.2743"></a>
+<span class="sourceLineNo">2744</span>      final String snapshotName,<a name="line.2744"></a>
+<span class="sourceLineNo">2745</span>      final TableName tableName) throws IOException, RestoreSnapshotException {<a name="line.2745"></a>
+<span class="sourceLineNo">2746</span>    final HBaseProtos.SnapshotDescription snapshot = HBaseProtos.SnapshotDescription.newBuilder()<a name="line.2746"></a>
+<span class="sourceLineNo">2747</span>        .setName(snapshotName).setTable(tableName.getNameAsString()).build();<a name="line.2747"></a>
+<span class="sourceLineNo">2748</span><a name="line.2748"></a>
+<span class="sourceLineNo">2749</span>    // actually restore the snapshot<a name="line.2749"></a>
+<span class="sourceLineNo">2750</span>    ClientSnapshotDescriptionUtils.assertSnapshotRequestIsValid(snapshot);<a name="line.2750"></a>
+<span class="sourceLineNo">2751</span><a name="line.2751"></a>
+<span class="sourceLineNo">2752</span>    RestoreSnapshotResponse response = executeCallable(<a name="line.2752"></a>
+<span class="sourceLineNo">2753</span>        new MasterCallable&lt;RestoreSnapshotResponse&gt;(getConnection(), getRpcControllerFactory()) {<a name="line.2753"></a>
+<span class="sourceLineNo">2754</span>      @Override<a name="line.2754"></a>
+<span class="sourceLineNo">2755</span>      protected RestoreSnapshotResponse rpcCall() throws Exception {<a name="line.2755"></a>
+<span class="sourceLineNo">2756</span>        final RestoreSnapshotRequest request = RestoreSnapshotRequest.newBuilder()<a name="line.2756"></a>
+<span class="sourceLineNo">2757</span>            .setSnapshot(snapshot)<a name="line.2757"></a>
+<span class="sourceLineNo">2758</span>            .setNonceGroup(ng.getNonceGroup())<a name="line.2758"></a>
+<span class="sourceLineNo">2759</span>            .setNonce(ng.newNonce())<a name="line.2759"></a>
+<span class="sourceLineNo">2760</span>            .build();<a name="line.2760"></a>
+<span class="sourceLineNo">2761</span>        return master.restoreSnapshot(getRpcController(), request);<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><a name="line.2764"></a>
+<span class="sourceLineNo">2765</span>    return new RestoreSnapshotFuture(this, snapshot, tableName, response);<a name="line.2765"></a>
+<span class="sourceLineNo">2766</span>  }<a name="line.2766"></a>
+<span class="sourceLineNo">2767</span><a name="line.2767"></a>
+<span class="sourceLineNo">2768</span>  private static class RestoreSnapshotFuture extends TableFuture&lt;Void&gt; {<a name="line.2768"></a>
+<span class="sourceLineNo">2769</span>    public RestoreSnapshotFuture(<a name="line.2769"></a>
+<span class="sourceLineNo">2770</span>        final HBaseAdmin admin,<a name="line.2770"></a>
+<span class="sourceLineNo">2771</span>        final HBaseProtos.SnapshotDescription snapshot,<a name="line.2771"></a>
+<span class="sourceLineNo">2772</span>        final TableName tableName,<a name="line.2772"></a>
+<span class="sourceLineNo">2773</span>        final RestoreSnapshotResponse response) {<a name="line.2773"></a>
+<span class="sourceLineNo">2774</span>      super(admin, tableName,<a name="line.2774"></a>
+<span class="sourceLineNo">2775</span>          (response != null &amp;&amp; response.hasProcId()) ? response.getProcId() : null);<a name="line.2775"></a>
+<span class="sourceLineNo">2776</span><a name="line.2776"></a>
+<span class="sourceLineNo">2777</span>      if (response != null &amp;&amp; !response.hasProcId()) {<a name="line.2777"></a>
+<span class="sourceLineNo">2778</span>        throw new UnsupportedOperationException("Client could not call old version of Server");<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><a name="line.2781"></a>
+<span class="sourceLineNo">2782</span>    public RestoreSnapshotFuture(<a name="line.2782"></a>
+<span class="sourceLineNo">2783</span>        final HBaseAdmin admin,<a name="line.2783"></a>
+<span class="sourceLineNo">2784</span>        final TableName tableName,<a name="line.2784"></a>
+<span class="sourceLineNo">2785</span>        final Long procId) {<a name="line.2785"></a>
+<span class="sourceLineNo">2786</span>      super(admin, tableName, procId);<a name="line.2786"></a>
 <span class="sourceLineNo">2787</span>    }<a name="line.2787"></a>
 <span class="sourceLineNo">2788</span><a name="line.2788"></a>
-<span class="sourceLineNo">2789</span>    public RestoreSnapshotFuture(<a name="line.2789"></a>
-<span class="sourceLineNo">2790</span>        final HBaseAdmin admin,<a name="line.2790"></a>
-<span class="sourceLineNo">2791</span>        final TableName tableName,<a name="line.2791"></a>
-<span class="sourceLineNo">2792</span>        final Long procId) {<a name="line.2792"></a>
-<span class="sourceLineNo">2793</span>      super(admin, tableName, procId);<a name="line.2793"></a>
-<span class="sourceLineNo">2794</span>    }<a name="line.2794"></a>
-<span class="sourceLineNo">2795</span><a name="line.2795"></a>
-<span class="sourceLineNo">2796</span>    @Override<a name="line.2796"></a>
-<span class="sourceLineNo">2797</span>    public String getOperationType() {<a name="line.2797"></a>
-<span class="sourceLineNo">2798</span>      return "MODIFY";<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><a name="line.2801"></a>
-<span class="sourceLineNo">2802</span>  @Override<a name="line.2802"></a>
-<span class="sourceLineNo">2803</span>  public List&lt;SnapshotDescription&gt; listSnapshots() throws IOException {<a name="line.2803"></a>
-<span class="sourceLineNo">2804</span>    return executeCallable(new MasterCallable&lt;List&lt;SnapshotDescription&gt;&gt;(getConnection(),<a name="line.2804"></a>
-<span class="sourceLineNo">2805</span>        getRpcControllerFactory()) {<a name="line.2805"></a>
-<span class="sourceLineNo">2806</span>      @Override<a name="line.2806"></a>
-<span class="sourceLineNo">2807</span>      protected List&lt;SnapshotDescription&gt; rpcCall() throws Exception {<a name="line.2807"></a>
-<span class="sourceLineNo">2808</span>        List&lt;HBaseProtos.SnapshotDescription&gt; snapshotsList = master<a name="line.2808"></a>
-<span class="sourceLineNo">2809</span>            .getCompletedSnapshots(getRpcController(),<a name="line.2809"></a>
-<span class="sourceLineNo">2810</span>                GetCompletedSnapshotsRequest.newBuilder().build())<a name="line.2810"></a>
-<span class="sourceLineNo">2811</span>            .getSnapshotsList();<a name="line.2811"></a>
-<span class="sourceLineNo">2812</span>        List&lt;SnapshotDescription&gt; result = new ArrayList&lt;&gt;(snapshotsList.size());<a name="line.2812"></a>
-<span class="sourceLineNo">2813</span>        for (HBaseProtos.SnapshotDescription snapshot : snapshotsList) {<a name="line.2813"></a>
-<span class="sourceLineNo">2814</span>          result.add(ProtobufUtil.createSnapshotDesc(snapshot));<a name="line.2814"></a>
-<span class="sourceLineNo">2815</span>        }<a name="line.2815"></a>
-<span class="sourceLineNo">2816</span>        return result;<a name="line.2816"></a>
-<span class="sourceLineNo">2817</span>      }<a name="line.2817"></a>
-<span class="sourceLineNo">2818</span>    });<a name="line.2818"></a>
-<span class="sourceLineNo">2819</span>  }<a name="line.2819"></a>
-<span class="sourceLineNo">2820</span><a name="line.2820"></a>
-<span class="sourceLineNo">2821</span>  @Override<a name="line.2821"></a>
-<span class="sourceLineNo">2822</span>  public List&lt;SnapshotDescription&gt; listSnapshots(String regex) throws IOException {<a name="line.2822"></a>
-<span class="sourceLineNo">2823</span>    return listSnapshots(Pattern.compile(regex));<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>  @Override<a name="line.2826"></a>
-<span class="sourceLineNo">2827</span>  public List&lt;SnapshotDescription&gt; listSnapshots(Pattern pattern) throws IOException {<a name="line.2827"></a>
-<span class="sourceLineNo">2828</span>    List&lt;SnapshotDescription&gt; matched = new LinkedList&lt;&gt;();<a name="line.2828"></a>
-<span class="sourceLineNo">2829</span>    List&lt;SnapshotDescription&gt; snapshots = listSnapshots();<a name="line.2829"></a>
-<span class="sourceLineNo">2830</span>    for (SnapshotDescription snapshot : snapshots) {<a name="line.2830"></a>
-<span class="sourceLineNo">2831</span>      if (pattern.matcher(snapshot.getName()).matches()) {<a name="line.2831"></a>
-<span class="sourceLineNo">2832</span>        matched.add(snapshot);<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>    return matched;<a name="line.2835"></a>
-<span class="sourceLineNo">2836</span>  }<a name="line.2836"></a>
-<span class="sourceLineNo">2837</span><a name="line.2837"></a>
-<span class="sourceLineNo">2838</span>  @Override<a name="line.2838"></a>
-<span class="sourceLineNo">2839</span>  public List&lt;SnapshotDescription&gt; listTableSnapshots(String tableNameRegex,<a name="line.2839"></a>
-<span class="sourceLineNo">2840</span>      String snapshotNameRegex) throws IOException {<a name="line.2840"></a>
-<span class="sourceLineNo">2841</span>    return listTableSnapshots(Pattern.compile(tableNameRegex), Pattern.compile(snapshotNameRegex));<a name="line.2841"></a>
-<span class="sourceLineNo">2842</span>  }<a name="line.2842"></a>
-<span class="sourceLineNo">2843</span><a name="line.2843"></a>
-<span class="sourceLineNo">2844</span>  @Override<a name="line.2844"></a>
-<span class="sourceLineNo">2845</span>  public List&lt;SnapshotDescription&gt; listTableSnapshots(Pattern tableNamePattern,<a name="line.2845"></a>
-<span class="sourceLineNo">2846</span>      Pattern snapshotNamePattern) throws IOException {<a name="line.2846"></a>
-<span class="sourceLineNo">2847</span>    TableName[] tableNames = listTableNames(tableNamePattern);<a name="line.2847"></a>
-<span class="sourceLineNo">2848</span><a name="line.2848"></a>
-<span class="sourceLineNo">2849</span>    List&lt;SnapshotDescription&gt; tableSnapshots = new LinkedList&lt;&gt;();<a name="line.2849"></a>
-<span class="sourceLineNo">2850</span>    List&lt;SnapshotDescription&gt; snapshots = listSnapshots(snapshotNamePattern);<a name="line.2850"></a>
-<span class="sourceLineNo">2851</span><a name="line.2851"></a>
-<span class="sourceLineNo">2852</span>    List&lt;TableName&gt; listOfTableNames = Arrays.asList(tableNames);<a name="line.2852"></a>
-<span class="sourceLineNo">2853</span>    for (SnapshotDescription snapshot : snapshots) {<a name="line.2853"></a>
-<span class="sourceLineNo">2854</span>      if (listOfTableNames.contains(snapshot.getTableName())) {<a name="line.2854"></a>
-<span class="sourceLineNo">2855</span>        tableSnapshots.add(snapshot);<a name="line.2855"></a>
-<span class="sourceLineNo">2856</span>      }<a name="line.2856"></a>
-<span class="sourceLineNo">2857</span>    }<a name="line.2857"></a>
-<span class="sourceLineNo">2858</span>    return tableSnapshots;<a name="line.2858"></a>
-<span class="sourceLineNo">2859</span>  }<a name="line.2859"></a>
-<span class="sourceLineNo">2860</span><a name="line.2860"></a>
-<span class="sourceLineNo">2861</span>  @Override<a name="line.2861"></a>
-<span class="sourceLineNo">2862</span>  public void deleteSnapshot(final byte[] snapshotName) throws IOException {<a name="line.2862"></a>
-<span class="sourceLineNo">2863</span>    deleteSnapshot(Bytes.toString(snapshotName));<a name="line.2863"></a>
-<span class="sourceLineNo">2864</span>  }<a name="line.2864"></a>
-<span class="sourceLineNo">2865</span><a name="line.2865"></a>
-<span class="sourceLineNo">2866</span>  @Override<a name="line.2866"></a>
-<span class="sourceLineNo">2867</span>  public void deleteSnapshot(final String snapshotName) throws IOException {<a name="line.2867"></a>
-<span class="sourceLineNo">2868</span>    // make sure the snapshot is possibly valid<a name="line.2868"></a>
-<span class="sourceLineNo">2869</span>    TableName.isLegalFullyQualifiedTableName(Bytes.toBytes(snapshotName));<a name="line.2869"></a>
-<span class="sourceLineNo">2870</span>    // do the delete<a name="line.2870"></a>
-<span class="sourceLineNo">2871</span>    executeCallable(new MasterCallable&lt;Void&gt;(getConnection(), getRpcControllerFactory()) {<a name="line.2871"></a>
-<span class="sourceLineNo">2872</span>      @Override<a name="line.2872"></a>
-<span class="sourceLineNo">2873</span>      protected Void rpcCall() throws Exception {<a name="line.2873"></a>
-<span class="sourceLineNo">2874</span>        master.deleteSnapshot(getRpcController(),<a name="line.2874"></a>
-<span class="sourceLineNo">2875</span>          DeleteSnapshotRequest.newBuilder().setSnapshot(<a name="line.2875"></a>
-<span class="sourceLineNo">2876</span>                HBaseProtos.SnapshotDescription.newBuilder().setName(snapshotName).build())<a name="line.2876"></a>
-<span class="sourceLineNo">2877</span>              .build()<a name="line.2877"></a>
-<span class="sourceLineNo">2878</span>        );<a name="line.2878"></a>
-<span class="sourceLineNo">2879</span>        return null;<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>  }<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 void deleteSnapshots(final String regex) throws IOException {<a name="line.2885"></a>
-<span class="sourceLineNo">2886</span>    deleteSnapshots(Pattern.compile(regex));<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 void deleteSnapshots(final Pattern pattern) throws IOException {<a name="line.2890"></a>
-<span class="sourceLineNo">2891</span>    List&lt;SnapshotDescription&gt; snapshots = listSnapshots(pattern);<a name="line.2891"></a>
-<span class="sourceLineNo">2892</span>    for (final SnapshotDescription snapshot : snapshots) {<a name="line.2892"></a>
-<span class="sourceLineNo">2893</span>      try {<a name="line.2893"></a>
-<span class="sourceLineNo">2894</span>        internalDeleteSnapshot(snapshot);<a name="line.2894"></a>
-<span class="sourceLineNo">2895</span>      } catch (IOException ex) {<a name="line.2895"></a>
-<span class="sourceLineNo">2896</span>        LOG.info(<a name="line.2896"></a>
-<span class="sourceLineNo">2897</span>          "Failed to delete snapshot " + snapshot.getName() + " for table " + snapshot.getTableNameAsString(),<a name="line.2897"></a>
-<span class="sourceLineNo">2898</span>          ex);<a name="line.2898"></a>
-<span class="sourceLineNo">2899</span>      }<a name="line.2899"></a>
-<span class="sourceLineNo">2900</span>    }<a name="line.2900"></a>
-<span class="sourceLineNo">2901</span>  }<a name="line.2901"></a>
-<span class="sourceLineNo">2902</span><a name="line.2902"></a>
-<span class="sourceLineNo">2903</span>  private void internalDeleteSnapshot(final SnapshotDescription snapshot) throws IOException {<a name="line.2903"></a>
-<span class="sourceLineNo">2904</span>    executeCallable(new MasterCallable&lt;Void&gt;(getConnection(), getRpcControllerFactory()) {<a name="line.2904"></a>
-<span class="sourceLineNo">2905</span>      @Override<a name="line.2905"></a>
-<span class="sourceLineNo">2906</span>      protected Void rpcCall() throws Exception {<a name="line.2906"></a>
-<span class="sourceLineNo">2907</span>        this.master.deleteSnapshot(getRpcController(), DeleteSnapshotRequest.newBuilder()<a name="line.2907"></a>
-<span class="sourceLineNo">2908</span>          .setSnapshot(ProtobufUtil.createHBaseProtosSnapshotDesc(snapshot)).build());<a name="line.2908"></a>
-<span class="sourceLineNo">2909</span>        return null;<a name="line.2909"></a>
-<span class="sourceLineNo">2910</span>      }<a name="line.2910"></a>
-<span class="sourceLineNo">2911</span>    });<a name="line.2911"></a>
-<span class="sourceLineNo">2912</span>  }<a name="line.2912"></a>
-<span class="sourceLineNo">2913</span><a name="line.2913"></a>
-<span class="sourceLineNo">2914</span>  @Override<a name="line.2914"></a>
-<span class="sourceLineNo">2915</span>  public void deleteTableSnapshots(String tableNameRegex, String snapshotNameRegex)<a name="line.2915"></a>
-<span class="sourceLineNo">2916</span>      throws IOException {<a name="line.2916"></a>
-<span class="sourceLineNo">2917</span>    deleteTableSnapshots(Pattern.compile(tableNameRegex), Pattern.compile(snapshotNameRegex));<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>  public void deleteTableSnapshots(Pattern tableNamePattern, Pattern snapshotNamePattern)<a name="line.2921"></a>
-<span class="sourceLineNo">2922</span>      throws IOException {<a name="line.2922"></a>
-<span class="sourceLineNo">2923</span>    List&lt;SnapshotDescription&gt; snapshots = listTableSnapshots(tableNamePattern, snapshotNamePattern);<a name="line.2923"></a>
-<span class="sourceLineNo">2924</span>    for (SnapshotDescription snapshot : snapshots) {<a name="line.2924"></a>
-<span class="sourceLineNo">2925</span>      try {<a name="line.2925"></a>
-<span class="sourceLineNo">2926</span>        internalDeleteSnapshot(snapshot);<a name="line.2926"></a>
-<span class="sourceLineNo">2927</span>        LOG.debug("Successfully deleted snapshot: " + snapshot.getName());<a name="line.2927"></a>
-<span class="sourceLineNo">2928</span>      } catch (IOException e) {<a name="line.2928"></a>
-<span class="sourceLineNo">2929</span>        LOG.error("Failed to delete snapshot: " + snapshot.getName(), e);<a name="line.2929"></a>
-<span class="sourceLineNo">2930</span>      }<a name="line.2930"></a>
-<span class="sourceLineNo">2931</span>    }<a name="line.2931"></a>
-<span class="sourceLineNo">2932</span>  }<a name="line.2932"></a>
-<span class="sourceLineNo">2933</span><a name="line.2933"></a>
-<span class="sourceLineNo">2934</span>  @Override<a name="line.2934"></a>
-<span class="sourceLineNo">2935</span>  public void setQuota(final QuotaSettings quota) throws IOException {<a name="line.2935"></a>
-<span class="sourceLineNo">2936</span>    executeCallable(new MasterCallable&lt;Void&gt;(getConnection(), getRpcControllerFactory()) {<a name="line.2936"></a>
-<span class="sourceLineNo">2937</span>      @Override<a name="line.2937"></a>
-<span class="sourceLineNo">2938</span>      protected Void rpcCall() throws Exception {<a name="line.2938"></a>
-<span class="sourceLineNo">2939</span>        this.master.setQuota(getRpcController(), QuotaSettings.buildSetQuotaRequestProto(quota));<a name="line.2939"></a>
-<span class="sourceLineNo">2940</span>        return null;<a name="line.2940"></a>
-<span class="sourceLineNo">2941</span>      }<a name="line.2941"></a>
-<span class="sourceLineNo">2942</span>    });<a name="line.2942"></a>
-<span class="sourceLineNo">2943</span>  }<a name="line.2943"></a>
-<span class="sourceLineNo">2944</span><a name="line.2944"></a>
-<span class="sourceLineNo">2945</span>  @Override<a name="line.2945"></a>
-<span class="sourceLineNo">2946</span>  public QuotaRetriever getQuotaRetriever(final QuotaFilter filter) throws IOException {<a name="line.2946"></a>
-<span class="sourceLineNo">2947</span>    return QuotaRetriever.open(conf, filter);<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>  private &lt;C extends RetryingCallable&lt;V&gt; &amp; Closeable, V&gt; V executeCallable(C callable)<a name="line.2950"></a>
-<span class="sourceLineNo">2951</span>      throws IOException {<a name="line.2951"></a>
-<span class="sourceLineNo">2952</span>    return executeCallable(callable, rpcCallerFactory, operationTimeout, rpcTimeout);<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>  static private &lt;C extends RetryingCallable&lt;V&gt; &amp; Closeable, V&gt; V executeCallable(C callable,<a name="line.2955"></a>
-<span class="sourceLineNo">2956</span>             RpcRetryingCallerFactory rpcCallerFactory, int operationTimeout, int rpcTimeout)<a name="line.2956"></a>
-<span class="sourceLineNo">2957</span>  throws IOException {<a name="line.2957"></a>
-<span class="sourceLineNo">2958</span>    RpcRetryingCaller&lt;V&gt; caller = rpcCallerFactory.newCaller(rpcTimeout);<a name="line.2958"></a>
-<span class="sourceLineNo">2959</span>    try {<a name="line.2959"></a>
-<span class="sourceLineNo">2960</span>      return caller.callWithRetries(callable, operationTimeout);<a name="line.2960"></a>
-<span class="sourceLineNo">2961</span>    } finally {<a name="line.2961"></a>
-<span class="sourceLineNo">2962</span>      callable.close();<a name="line.2962"></a>
-<span class="sourceLineNo">2963</span>    }<a name="line.2963"></a>
-<span class="sourceLineNo">2964</span>  }<a name="line.2964"></a>
-<span class="sourceLineNo">2965</span><a name="line.2965"></a>
-<span class="sourceLineNo">2966</span>  @Override<a name="line.2966"></a>
-<span class="sourceLineNo">2967</span>  // Coprocessor Endpoint against the Master.<a name="line.2967"></a>
-<span class="sourceLineNo">2968</span>  public CoprocessorRpcChannel coprocessorService() {<a name="line.2968"></a>
-<span class="sourceLineNo">2969</span>    return new SyncCoprocessorRpcChannel() {<a name="line.2969"></a>
-<span class="sourceLineNo">2970</span>      @Override<a name="line.2970"></a>
-<span class="sourceLineNo">2971</span>      protected Message callExecService(final RpcController controller,<a name="line.2971"></a>
-<span class="sourceLineNo">2972</span>          final Descriptors.MethodDescriptor method, final Message request,<a name="line.2972"></a>
-<span class="sourceLineNo">2973</span>          final Message responsePrototype)<a name="line.2973"></a>
-<span class="sourceLineNo">2974</span>      throws IOException {<a name="line.2974"></a>
-<span class="sourceLineNo">2975</span>        if (LOG.isTraceEnabled()) {<a name="line.2975"></a>
-<span class="sourceLineNo">2976</span>          LOG.trace("Call: " + method.getName() + ", " + request.toString());<a name="line.2976"></a>
-<span class="sourceLineNo">2977</span>        }<a name="line.2977"></a>
-<span class="sourceLineNo">2978</span>        // Try-with-resources so close gets called when we are done.<a name="line.2978"></a>
-<span class="sourceLineNo">2979</span>        try (MasterCallable&lt;CoprocessorServiceResponse&gt; callable =<a name="line.2979"></a>
-<span class="sourceLineNo">2980</span>            new MasterCallable&lt;CoprocessorServiceResponse&gt;(connection,<a name="line.2980"></a>
-<span class="sourceLineNo">2981</span>                connection.getRpcControllerFactory()) {<a name="line.2981"></a>
-<span class="sourceLineNo">2982</span>          @Override<a name="line.2982"></a>
-<span class="sourceLineNo">2983</span>          protected CoprocessorServiceResponse rpcCall() throws Exception {<a name="line.2983"></a>
-<span class="sourceLineNo">2984</span>            CoprocessorServiceRequest csr =<a name="line.2984"></a>
-<span class="sourceLineNo">2985</span>                CoprocessorRpcUtils.getCoprocessorServiceRequest(method, request);<a name="line.2985"></a>
-<span class="sourceLineNo">2986</span>            return this.master.execMasterService(getRpcController(), csr);<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>          // TODO: Are we retrying here? Does not seem so. We should use RetryingRpcCaller<a name="line.2989"></a>
-<span class="sourceLineNo">2990</span>          callable.prepare(false);<a name="line.2990"></a>
-<span class="sourceLineNo">2991</span>          int operationTimeout = connection.getConnectionConfiguration().getOperationTimeout();<a name="line.2991"></a>
-<span class="sourceLineNo">2992</span>          CoprocessorServiceResponse result = callable.call(operationTimeout);<a name="line.2992"></a>
-<span class="sourceLineNo">2993</span>          return CoprocessorRpcUtils.getResponse(result, responsePrototype);<a name="line.2993"></a>
-<span class="sourceLineNo">2994</span>        }<a name="line.2994"></a>
-<span class="sourceLineNo">2995</span>      }<a name="line.2995"></a>
-<span class="sourceLineNo">2996</span>    };<a name="line.2996"></a>
-<span class="sourceLineNo">2997</span>  }<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>   * Simple {@link Abortable}, throwing RuntimeException on abort.<a name="line.3000"></a>
-<span class="sourceLineNo">3001</span>   */<a name="line.3001"></a>
-<span class="sourceLineNo">3002</span>  private static class ThrowableAbortable implements Abortable {<a name="line.3002"></a>
-<span class="sourceLineNo">3003</span>    @Override<a name="line.3003"></a>
-<span class="sourceLineNo">3004</span>    public void abort(String why, Throwable e) {<a name="line.3004"></a>
-<span class="sourceLineNo">3005</span>      throw new RuntimeException(why, e);<a name="line.3005"></a>
-<span class="sourceLineNo">3006</span>    }<a name="line.3006"></a>
-<span class="sourceLineNo">3007</span><a name="line.3007"></a>
-<span class="sourceLineNo">3008</span>    @Override<a name="line.3008"></a>
-<span class="sourceLineNo">3009</span>    public boolean isAborted() {<a name="line.3009"></a>
-<span class="sourceLineNo">3010</span>      return true;<a name="line.3010"></a>
-<span class="sourceLineNo">3011</span>    }<a name="line.3011"></a>
-<span class="sourceLineNo">3012</span>  }<a name="line.3012"></a>
-<span class="sourceLineNo">3013</span><a name="line.3013"></a>
-<span class="sourceLineNo">3014</span>  @Override<a name="line.3014"></a>
-<span class="sourceLineNo">3015</span>  public CoprocessorRpcChannel coprocessorService(final ServerName serverName) {<a name="line.3015"></a>
-<span class="sourceLineNo">3016</span>    return new SyncCoprocessorRpcChannel() {<a name="line.3016"></a>
-<span class="sourceLineNo">3017</span>      @Override<a name="line.3017"></a>
-<span class="sourceLineNo">3018</span>      protected Message callExecService(RpcController controller,<a name="line.3018"></a>
-<span class="sourceLineNo">3019</span>          Descriptors.MethodDescriptor method, Message request, Message responsePrototype)<a name="line.3019"></a>
-<span class="sourceLineNo">3020</span>      throws IOException {<a name="line.3020"></a>
-<span class="sourceLineNo">3021</span>        if (LOG.isTraceEnabled()) {<a name="line.3021"></a>
-<span class="sourceLineNo">3022</span>          LOG.trace("Call: " + method.getName() + ", " + request.toString());<a name="line.3022"></a>
-<span class="sourceLineNo">3023</span>        }<a name="line.3023"></a>
-<span class="sourceLineNo">3024</span>        CoprocessorServiceRequest csr =<a name="line.3024"></a>
-<span class="sourceLineNo">3025</span>            CoprocessorRpcUtils.getCoprocessorServiceRequest(method, request);<a name="line.3025"></a>
-<span class="sourceLineNo">3026</span>        // TODO: Are we retrying here? Does not seem so. We should use RetryingRpcCaller<a name="line.3026"></a>
-<span class="sourceLineNo">3027</span>        // TODO: Make this same as RegionCoprocessorRpcChannel and MasterCoprocessorRpcChannel. They<a name="line.3027"></a>
-<span class="sourceLineNo">3028</span>        // are all different though should do same thing; e.g. RpcChannel setup.<a name="line.3028"></a>
-<span class="sourceLineNo">3029</span>        ClientProtos.ClientService.BlockingInterface stub = connection.getClient(serverName);<a name="line.3029"></a>
-<span class="sourceLineNo">3030</span>        CoprocessorServiceResponse result;<a name="line.3030"></a>
-<span class="sourceLineNo">3031</span>        try {<a name="line.3031"></a>
-<span class="sourceLineNo">3032</span>          result = stub.<a name="line.3032"></a>
-<span class="sourceLineNo">3033</span>              execRegionServerService(connection.getRpcControllerFactory().newController(), csr);<a name="line.3033"></a>
-<span class="sourceLineNo">3034</span>          return CoprocessorRpcUtils.getResponse(result, responsePrototype);<a name="line.3034"></a>
-<span class="sourceLineNo">3035</span>        } catch (ServiceException e) {<a name="line.3035"></a>
-<span class="sourceLineNo">3036</span>          throw ProtobufUtil.handleRemoteException(e);<a name="line.3036"></a>
-<span class="sourceLineNo">3037</span>        }<a name="line.3037"></a>
-<span class="sourceLineNo">3038</span>      }<a name="line.3038"></a>
-<span class="sourceLineNo">3039</span>    };<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>  @Override<a name="line.3042"></a>
-<span class="sourceLineNo">3043</span>  public void updateConfiguration(final ServerName server) throws IOException {<a name="line.3043"></a>
-<span class="sourceLineNo">3044</span>    final AdminService.BlockingInterface admin = this.connection.getAdmin(server);<a name="line.3044"></a>
-<span class="sourceLineNo">3045</span>    Callable&lt;Void&gt; callable = new Callable&lt;Void&gt;() {<a name="line.3045"></a>
-<span class="sourceLineNo">3046</span>      @Override<a name="line.3046"></a>
-<span class="sourceLineNo">3047</span>      public Void call() throws Exception {<a name="line.3047"></a>
-<span class="sourceLineNo">3048</span>        admin.updateConfiguration(null, UpdateConfigurationRequest.getDefaultInstance());<a name="line.3048"></a>
-<span class="sourceLineNo">3049</span>        return null;<a name="line.3049"></a>
-<span class="sourceLineNo">3050</span>      }<a name="line.3050"></a>
-<span class="sourceLineNo">3051</span>    };<a name="line.3051"></a>
-<span class="sourceLineNo">3052</span>    ProtobufUtil.call(callable);<a name="line.3052"></a>
-<span class="sourceLineNo">3053</span>  }<a name="line.3053"></a>
-<span class="sourceLineNo">3054</span><a name="line.3054"></a>
-<span class="sourceLineNo">3055</span>  @Override<a name="line.3055"></a>
-<span class="sourceLineNo">3056</span>  public void updateConfiguration() throws IOException {<a name="line.3056"></a>
-<span class="sourceLineNo">3057</span>    for (ServerName server : this.getClusterStatus().getServers()) {<a name="line.3057"></a>
-<span class="sourceLineNo">3058</span>      updateConfiguration(server);<a name="line.3058"></a>
-<span class="sourceLineNo">3059</span>    }<a name="line.3059"></a>
+<span class="sourceLineNo">2789</span>    @Override<a name="line.2789"></a>
+<span class="sourceLineNo">2790</span>    public String getOperationType() {<a name="line.2790"></a>
+<span class="sourceLineNo">2791</span>      return "MODIFY";<a name="line.2791"></a>
+<span class="sourceLineNo">2792</span>    }<a name="line.2792"></a>
+<span class="sourceLineNo">2793</span>  }<a name="line.2793"></a>
+<span class="sourceLineNo">2794</span><a name="line.2794"></a>
+<span class="sourceLineNo">2795</span>  @Override<a name="line.2795"></a>
+<span class="sourceLineNo">2796</span>  public List&lt;SnapshotDescription&gt; listSnapshots() throws IOException {<a name="line.2796"></a>
+<span class="sourceLineNo">2797</span>    return executeCallable(new MasterCallable&lt;List&lt;SnapshotDescription&gt;&gt;(getConnection(),<a name="line.2797"></a>
+<span class="sourceLineNo">2798</span>        getRpcControllerFactory()) {<a name="line.2798"></a>
+<span class="sourceLineNo">2799</span>      @Override<a name="line.2799"></a>
+<span class="sourceLineNo">2800</span>      protected List&lt;SnapshotDescription&gt; rpcCall() throws Exception {<a name="line.2800"></a>
+<span class="sourceLineNo">2801</span>        List&lt;HBaseProtos.SnapshotDescription&gt; snapshotsList = master<a name="line.2801"></a>
+<span class="sourceLineNo">2802</span>            .getCompletedSnapshots(getRpcController(),<a name="line.2802"></a>
+<span class="sourceLineNo">2803</span>                GetCompletedSnapshotsRequest.newBuilder().build())<a name="line.2803"></a>
+<span class="sourceLineNo">2804</span>            .getSnapshotsList();<a name="line.2804"></a>
+<span class="sourceLineNo">2805</span>        List&lt;SnapshotDescription&gt; result = new ArrayList&lt;&gt;(snapshotsList.size());<a name="line.2805"></a>
+<span class="sourceLineNo">2806</span>        for (HBaseProtos.SnapshotDescription snapshot : snapshotsList) {<a name="line.2806"></a>
+<span class="sourceLineNo">2807</span>          result.add(ProtobufUtil.createSnapshotDesc(snapshot));<a name="line.2807"></a>
+<span class="sourceLineNo">2808</span>        }<a name="line.2808"></a>
+<span class="sourceLineNo">2809</span>        return result;<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>  }<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 List&lt;SnapshotDescription&gt; listSnapshots(String regex) throws IOException {<a name="line.2815"></a>
+<span class="sourceLineNo">2816</span>    return listSnapshots(Pattern.compile(regex));<a name="line.2816"></a>
+<span class="sourceLineNo">2817</span>  }<a name="line.2817"></a>
+<span class="sourceLineNo">2818</span><a name="line.2818"></a>
+<span class="sourceLineNo">2819</span>  @Override<a name="line.2819"></a>
+<span class="sourceLineNo">2820</span>  public List&lt;SnapshotDescription&gt; listSnapshots(Pattern pattern) throws IOException {<a name="line.2820"></a>
+<span class="sourceLineNo">2821</span>    List&lt;SnapshotDescription&gt; matched = new LinkedList&lt;&gt;();<a name="line.2821"></a>
+<span class="sourceLineNo">2822</span>    List&lt;SnapshotDescription&gt; snapshots = listSnapshots();<a name="line.2822"></a>
+<span class="sourceLineNo">2823</span>    for (SnapshotDescription snapshot : snapshots) {<a name="line.2823"></a>
+<span class="sourceLineNo">2824</span>      if (pattern.matcher(snapshot.getName()).matches()) {<a name="line.2824"></a>
+<span class="sourceLineNo">2825</span>        matched.add(snapshot);<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>    return matched;<a name="line.2828"></a>
+<span class="sourceLineNo">2829</span>  }<a name="line.2829"></a>
+<span class="sourceLineNo">2830</span><a name="line.2830"></a>
+<span class="sourceLineNo">2831</span>  @Override<a name="line.2831"></a>
+<span class="sourceLineNo">2832</span>  public List&lt;SnapshotDescription&gt; listTableSnapshots(String tableNameRegex,<a name="line.2832"></a>
+<span class="sourceLineNo">2833</span>      String snapshotNameRegex) throws IOException {<a name="line.2833"></a>
+<span class="sourceLineNo">2834</span>    return listTableSnapshots(Pattern.compile(tableNameRegex), Pattern.compile(snapshotNameRegex));<a name="line.2834"></a>
+<span class="sourceLineNo">2835</span>  }<a name="line.2835"></a>
+<span class="sourceLineNo">2836</span><a name="line.2836"></a>
+<span class="sourceLineNo">2837</span>  @Override<a name="line.2837"></a>
+<span class="sourceLineNo">2838</span>  public List&lt;SnapshotDescription&gt; listTableSnapshots(Pattern tableNamePattern,<a name="line.2838"></a>
+<span class="sourceLineNo">2839</span>      Pattern snapshotNamePattern) throws IOException {<a name="line.2839"></a>
+<span class="sourceLineNo">2840</span>    TableName[] tableNames = listTableNames(tableNamePattern);<a name="line.2840"></a>
+<span class="sourceLineNo">2841</span><a name="line.2841"></a>
+<span class="sourceLineNo">2842</span>    List&lt;SnapshotDescription&gt; tableSnapshots = new LinkedList&lt;&gt;();<a name="line.2842"></a>
+<span class="sourceLineNo">2843</span>    List&lt;SnapshotDescription&gt; snapshots = listSnapshots(snapshotNamePattern);<a name="line.2843"></a>
+<span class="sourceLineNo">2844</span><a name="line.2844"></a>
+<span class="sourceLineNo">2845</span>    List&lt;TableName&gt; listOfTableNames = Arrays.asList(tableNames);<a name="line.2845"></a>
+<span class="sourceLineNo">2846</span>    for (SnapshotDescription snapshot : snapshots) {<a name="line.2846"></a>
+<span class="sourceLineNo">2847</span>      if (listOfTableNames.contains(snapshot.getTableName())) {<a name="line.2847"></a>
+<span class="sourceLineNo">2848</span>        tableSnapshots.add(snapshot);<a name="line.2848"></a>
+<span class="sourceLineNo">2849</span>      }<a name="line.2849"></a>
+<span class="sourceLineNo">2850</span>    }<a name="line.2850"></a>
+<span class="sourceLineNo">2851</span>    return tableSnapshots;<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>  @Override<a name="line.2854"></a>
+<span class="sourceLineNo">2855</span>  public void deleteSnapshot(final byte[] snapshotName) throws IOException {<a name="line.2855"></a>
+<span class="sourceLineNo">2856</span>    deleteSnapshot(Bytes.toString(snapshotName));<a name="line.2856"></a>
+<span class="sourceLineNo">2857</span>  }<a name="line.2857"></a>
+<span class="sourceLineNo">2858</span><a name="line.2858"></a>
+<span class="sourceLineNo">2859</span>  @Override<a name="line.2859"></a>
+<span class="sourceLineNo">2860</span>  public void deleteSnapshot(final String snapshotName) throws IOException {<a name="line.2860"></a>
+<span class="sourceLineNo">2861</span>    // make sure the snapshot is possibly valid<a name="line.2861"></a>
+<span class="sourceLineNo">2862</span>    TableName.isLegalFullyQualifiedTableName(Bytes.toBytes(snapshotName));<a name="line.2862"></a>
+<span class="sourceLineNo">2863</span>    // do the delete<a name="line.2863"></a>
+<span class="sourceLineNo">2864</span>    executeCallable(new MasterCallable&lt;Void&gt;(getConnection(), getRpcControllerFactory()) {<a name="line.2864"></a>
+<span class="sourceLineNo">2865</span>      @Override<a name="line.2865"></a>
+<span class="sourceLineNo">2866</span>      protected Void rpcCall() throws Exception {<a name="line.2866"></a>
+<span class="sourceLineNo">2867</span>        master.deleteSnapshot(getRpcController(),<a name="line.2867"></a>
+<span class="sourceLineNo">2868</span>          DeleteSnapshotRequest.newBuilder().setSnapshot(<a name="line.2868"></a>
+<span class="sourceLineNo">2869</span>                HBaseProtos.SnapshotDescription.newBuilder().setName(snapshotName).build())<a name="line.2869"></a>
+<span class="sourceLineNo">2870</span>              .build()<a name="line.2870"></a>
+<span class="sourceLineNo">2871</span>        );<a name="line.2871"></a>
+<span class="sourceLineNo">2872</span>        return null;<a name="line.2872"></a>
+<span class="sourceLineNo">2873</span>      }<a name="line.2873"></a>
+<span class="sourceLineNo">2874</span>    });<a name="line.2874"></a>
+<span class="sourceLineNo">2875</span>  }<a name="line.2875"></a>
+<span class="sourceLineNo">2876</span><a name="line.2876"></a>
+<span class="sourceLineNo">2877</span>  @Override<a name="line.2877"></a>
+<span class="sourceLineNo">2878</span>  public void deleteSnapshots(final String regex) throws IOException {<a name="line.2878"></a>
+<span class="sourceLineNo">2879</span>    deleteSnapshots(Pattern.compile(regex));<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>  @Override<a name="line.2882"></a>
+<span class="sourceLineNo">2883</span>  public void deleteSnapshots(final Pattern pattern) throws IOException {<a name="line.2883"></a>
+<span class="sourceLineNo">2884</span>    List&lt;SnapshotDescription&gt; snapshots = listSnapshots(pattern);<a name="line.2884"></a>
+<span class="sourceLineNo">2885</span>    for (final SnapshotDescription snapshot : snapshots) {<a name="line.2885"></a>
+<span class="sourceLineNo">2886</span>      try {<a name="line.2886"></a>
+<span class="sourceLineNo">2887</span>        internalDeleteSnapshot(snapshot);<a name="line.2887"></a>
+<span class="sourceLineNo">2888</span>      } catch (IOException ex) {<a name="line.2888"></a>
+<span class="sourceLineNo">2889</span>        LOG.info(<a name="line.2889"></a>
+<span class="sourceLineNo">2890</span>          "Failed to delete snapshot " + snapshot.getName() + " for table " + snapshot.getTableNameAsString(),<a name="line.2890"></a>
+<span class="sourceLineNo">2891</span>          ex);<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><a name="line.2895"></a>
+<span class="sourceLineNo">2896</span>  private void internalDeleteSnapshot(final SnapshotDescription snapshot) throws IOException {<a name="line.2896"></a>
+<span class="sourceLineNo">2897</span>    executeCallable(new MasterCallable&lt;Void&gt;(getConnection(), getRpcControllerFactory()) {<a name="line.2897"></a>
+<span class="sourceLineNo">2898</span>      @Override<a name="line.2898"></a>
+<span class="sourceLineNo">2899</span>      protected Void rpcCall() throws Exception {<a name="line.2899"></a>
+<span class="sourceLineNo">2900</span>        this.master.deleteSnapshot(getRpcController(), DeleteSnapshotRequest.newBuilder()<a name="line.2900"></a>
+<span class="sourceLineNo">2901</span>          .setSnapshot(ProtobufUtil.createHBaseProtosSnapshotDesc(snapshot)).build());<a name="line.2901"></a>
+<span class="sourceLineNo">2902</span>        return null;<a name="line.2902"></a>
+<span class="sourceLineNo">2903</span>      }<a name="line.2903"></a>
+<span class="sourceLineNo">2904</span>    });<a name="line.2904"></a>
+<span class="sourceLineNo">2905</span>  }<a name="line.2905"></a>
+<span class="sourceLineNo">2906</span><a name="line.2906"></a>
+<span class="sourceLineNo">2907</span>  @Override<a name="line.2907"></a>
+<span class="sourceLineNo">2908</span>  public void deleteTableSnapshots(String tableNameRegex, String snapshotNameRegex)<a name="line.2908"></a>
+<span class="sourceLineNo">2909</span>      throws IOException {<a name="line.2909"></a>
+<span class="sourceLineNo">2910</span>    deleteTableSnapshots(Pattern.compile(tableNameRegex), Pattern.compile(snapshotNameRegex));<a name="line.2910"></a>
+<span class="sourceLineNo">2911</span>  }<a name="line.2911"></a>
+<span class="sourceLineNo">2912</span><a name="line.2912"></a>
+<span class="sourceLineNo">2913</span>  @Override<a name="line.2913"></a>
+<span class="sourceLineNo">2914</span>  public void deleteTableSnapshots(Pattern tableNamePattern, Pattern snapshotNamePattern)<a name="line.2914"></a>
+<span class="sourceLineNo">2915</span>      throws IOException {<a name="line.2915"></a>
+<span class="sourceLineNo">2916</span>    List&lt;SnapshotDescription&gt; snapshots = listTableSnapshots(tableNamePattern, snapshotNamePattern);<a name="line.2916"></a>
+<span class="sourceLineNo">2917</span>    for (SnapshotDescription snapshot : snapshots) {<a name="line.2917"></a>
+<span class="sourceLineNo">2918</span>      try {<a name="line.2918"></a>
+<span class="sourceLineNo">2919</span>        internalDeleteSnapshot(snapshot);<a name="line.2919"></a>
+<span class="sourceLineNo">2920</span>        LOG.debug("Successfully deleted snapshot: " + snapshot.getName());<a name="line.2920"></a>
+<span class="sourceLineNo">2921</span>      } catch (IOException e) {<a name="line.2921"></a>
+<span class="sourceLineNo">2922</span>        LOG.error("Failed to delete snapshot: " + snapshot.getName(), e);<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>  @Override<a name="line.2927"></a>
+<span class="sourceLineNo">2928</span>  public void setQuota(final QuotaSettings quota) throws IOException {<a name="line.2928"></a>
+<span class="sourceLineNo">2929</span>    executeCallable(new MasterCallable&lt;Void&gt;(getConnection(), getRpcControllerFactory()) {<a name="line.2929"></a>
+<span class="sourceLineNo">2930</span>      @Override<a name="line.2930"></a>
+<span class="sourceLineNo">2931</span>      protected Void rpcCall() throws Exception {<a name="line.2931"></a>
+<span class="sourceLineNo">2932</span>        this.master.setQuota(getRpcController(), QuotaSettings.buildSetQuotaRequestProto(quota));<a name="line.2932"></a>
+<span class="sourceLineNo">2933</span>        return null;<a name="line.2933"></a>
+<span class="sourceLineNo">2934</span>      }<a name="line.2934"></a>
+<span class="sourceLineNo">2935</span>    });<a name="line.2935"></a>
+<span class="sourceLineNo">2936</span>  }<a name="line.2936"></a>
+<span class="sourceLineNo">2937</span><a name="line.2937"></a>
+<span class="sourceLineNo">2938</span>  @Override<a name="line.2938"></a>
+<span class="sourceLineNo">2939</span>  public QuotaRetriever getQuotaRetriever(final QuotaFilter filter) throws IOException {<a name="line.2939"></a>
+<span class="sourceLineNo">2940</span>    return QuotaRetriever.open(conf, filter);<a name="line.2940"></a>
+<span class="sourceLineNo">2941</span>  }<a name="line.2941"></a>
+<span class="sourceLineNo">2942</span><a name="line.2942"></a>
+<span class="sourceLineNo">2943</span>  private &lt;C extends RetryingCallable&lt;V&gt; &amp; Closeable, V&gt; V executeCallable(C callable)<a name="line.2943"></a>
+<span class="sourceLineNo">2944</span>      throws IOException {<a name="line.2944"></a>
+<span class="sourceLineNo">2945</span>    return executeCallable(callable, rpcCallerFactory, operationTimeout, rpcTimeout);<a name="line.2945"></a>
+<span class="sourceLineNo">2946</span>  }<a name="line.2946"></a>
+<span class="sourceLineNo">2947</span><a name="line.2947"></a>
+<span class="sourceLineNo">2948</span>  static private &lt;C extends RetryingCallable&lt;V&gt; &amp; Closeable, V&gt; V executeCallable(C callable,<a name="line.2948"></a>
+<span class="sourceLineNo">2949</span>             RpcRetryingCallerFactory rpcCallerFactory, int operationTimeout, int rpcTimeout)<a name="line.2949"></a>
+<span class="sourceLineNo">2950</span>  throws IOException {<a name="line.2950"></a>
+<span class="sourceLineNo">2951</span>    RpcRetryingCaller&lt;V&gt; caller = rpcCallerFactory.newCaller(rpcTimeout);<a name="line.2951"></a>
+<span class="sourceLineNo">2952</span>    try {<a name="line.2952"></a>
+<span class="sourceLineNo">2953</span>      return caller.callWithRetries(callable, operationTimeout);<a name="line.2953"></a>
+<span class="sourceLineNo">2954</span>    } finally {<a name="line.2954"></a>
+<span class="sourceLineNo">2955</span>      callable.close();<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>  @Override<a name="line.2959"></a>
+<span class="sourceLineNo">2960</span>  // Coprocessor Endpoint against the Master.<a name="line.2960"></a>
+<span class="sourceLineNo">2961</span>  public CoprocessorRpcChannel coprocessorService() {<a name="line.2961"></a>
+<span class="sourceLineNo">2962</span>    return new SyncCoprocessorRpcChannel() {<a name="line.2962"></a>
+<span class="sourceLineNo">2963</span>      @Override<a name="line.2963"></a>
+<span class="sourceLineNo">2964</span>      protected Message callExecService(final RpcController controller,<a name="line.2964"></a>
+<span class="sourceLineNo">2965</span>          final Descriptors.MethodDescriptor method, final Message request,<a name="line.2965"></a>
+<span class="sourceLineNo">2966</span>          final Message responsePrototype)<a name="line.2966"></a>
+<span class="sourceLineNo">2967</span>      throws IOException {<a name="line.2967"></a>
+<span class="sourceLineNo">2968</span>        if (LOG.isTraceEnabled()) {<a name="line.2968"></a>
+<span class="sourceLineNo">2969</span>          LOG.trace("Call: " + method.getName() + ", " + request.toString());<a name="line.2969"></a>
+<span class="sourceLineNo">2970</span>        }<a name="line.2970"></a>
+<span class="sourceLineNo">2971</span>        // Try-with-resources so close gets called when we are done.<a name="line.2971"></a>
+<span class="sourceLineNo">2972</span>        try (MasterCallable&lt;CoprocessorServiceResponse&gt; callable =<a name="line.2972"></a>
+<span class="sourceLineNo">2973</span>            new MasterCallable&lt;CoprocessorServiceResponse&gt;(connection,<a name="line.2973"></a>
+<span class="sourceLineNo">2974</span>                connection.getRpcControllerFactory()) {<a name="line.2974"></a>
+<span class="sourceLineNo">2975</span>          @Override<a name="line.2975"></a>
+<span class="sourceLineNo">2976</span>          protected CoprocessorServiceResponse rpcCall() throws Exception {<a name="line.2976"></a>
+<span class="sourceLineNo">2977</span>            CoprocessorServiceRequest csr =<a name="line.2977"></a>
+<span class="sourceLineNo">2978</span>                CoprocessorRpcUtils.getCoprocessorServiceRequest(method, request);<a name="line.2978"></a>
+<span class="sourceLineNo">2979</span>            return this.master.execMasterService(getRpcController(), csr);<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>          // TODO: Are we retrying here? Does not seem so. We should use RetryingRpcCaller<a name="line.2982"></a>
+<span class="sourceLineNo">2983</span>          callable.prepare(false);<a name="line.2983"></a>
+<span class="sourceLineNo">2984</span>          int operationTimeout = connection.getConnectionConfiguration().getOperationTimeout();<a name="line.2984"></a>
+<span class="sourceLineNo">2985</span>          CoprocessorServiceResponse result = callable.call(operationTimeout);<a name="line.2985"></a>
+<span class="sourceLineNo">2986</span>          return CoprocessorRpcUtils.getResponse(result, responsePrototype);<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>  }<a name="line.2990"></a>
+<span class="sourceLineNo">2991</span><a name="line.2991"></a>
+<span class="sourceLineNo">2992</span>  /**<a name="line.2992"></a>
+<span class="sourceLineNo">2993</span>   * Simple {@link Abortable}, throwing RuntimeException on abort.<a name="line.2993"></a>
+<span class="sourceLineNo">2994</span>   */<a name="line.2994"></a>
+<span class="sourceLineNo">2995</span>  private static class ThrowableAbortable implements Abortable {<a name="line.2995"></a>
+<span class="sourceLineNo">2996</span>    @Override<a name="line.2996"></a>
+<span class="sourceLineNo">2997</span>    public void abort(String why, Throwable e) {<a name="line.2997"></a>
+<span class="sourceLineNo">2998</span>      throw new RuntimeException(why, e);<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>    @Override<a name="line.3001"></a>
+<span class="sourceLineNo">3002</span>    public boolean isAborted() {<a name="line.3002"></a>
+<span class="sourceLineNo">3003</span>      return true;<a name="line.3003"></a>
+<span class="sourceLineNo">3004</span>    }<a name="line.3004"></a>
+<span class="sourceLineNo">3005</span>  }<a name="line.3005"></a>
+<span class="sourceLineNo">3006</span><a name="line.3006"></a>
+<span class="sourceLineNo">3007</span>  @Override<a name="line.3007"></a>
+<span class="sourceLineNo">3008</span>  public CoprocessorRpcChannel coprocessorService(final ServerName serverName) {<a name="line.3008"></a>
+<span class="sourceLineNo">3009</span>    return new SyncCoprocessorRpcChannel() {<a name="line.3009"></a>
+<span class="sourceLineNo">3010</span>      @Override<a name="line.3010"></a>
+<span class="sourceLineNo">3011</span>      protected Message callExecService(RpcController controller,<a name="line.3011"></a>
+<span class="sourceLineNo">3012</span>          Descriptors.MethodDescriptor method, Message request, Message responsePrototype)<a name="line.3012"></a>
+<span class="sourceLineNo">3013</span>      throws IOException {<a name="line.3013"></a>
+<span class="sourceLineNo">3014</span>        if (LOG.isTraceEnabled()) {<a name="line.3014"></a>
+<span class="sourceLineNo">3015</span>          LOG.trace("Call: " + method.getName() + ", " + request.toString());<a name="line.3015"></a>
+<span class="sourceLineNo">3016</span>        }<a name="line.3016"></a>
+<span class="sourceLineNo">3017</span>        CoprocessorServiceRequest csr =<a name="line.3017"></a>
+<span class="sourceLineNo">3018</span>            CoprocessorRpcUtils.getCoprocessorServiceRequest(method, request);<a name="line.3018"></a>
+<span class="sourceLineNo">3019</span>        // TODO: Are we retrying here? Does not seem so. We should use RetryingRpcCaller<a name="line.3019"></a>
+<span class="sourceLineNo">3020</span>        // TODO: Make this same as RegionCoprocessorRpcChannel and MasterCoprocessorRpcChannel. They<a name="line.3020"></a>
+<span class="sourceLineNo">3021</span>        // are all different though should do same thing; e.g. RpcChannel setup.<a name="line.3021"></a>
+<span class="sourceLineNo">3022</span>        ClientProtos.ClientService.BlockingInterface stub = connection.getClient(serverName);<a name="line.3022"></a>
+<span class="sourceLineNo">3023</span>        CoprocessorServiceResponse result;<a name="line.3023"></a>
+<span class="sourceLineNo">3024</span>        try {<a name="line.3024"></a>
+<span class="sourceLineNo">3025</span>          result = stub.<a name="line.3025"></a>
+<span class="sourceLineNo">3026</span>              execRegionServerService(connection.getRpcControllerFactory().newController(), csr);<a name="line.3026"></a>
+<span class="sourceLineNo">3027</span>          return CoprocessorRpcUtils.getResponse(result, responsePrototype);<a name="line.3027"></a>
+<span class="sourceLineNo">3028</span>        } catch (ServiceException e) {<a name="line.3028"></a>
+<span class="sourceLineNo">3029</span>          throw ProtobufUtil.handleRemoteException(e);<a name="line.3029"></a>
+<span class="sourceLineNo">3030</span>        }<a name="line.3030"></a>
+<span class="sourceLineNo">3031</span>      }<a name="line.3031"></a>
+<span class="sourceLineNo">3032</span>    };<a name="line.3032"></a>
+<span class="sourceLineNo">3033</span>  }<a name="line.3033"></a>
+<span class="sourceLineNo">3034</span><a name="line.3034"></a>
+<span class="sourceLineNo">3035</span>  @Override<a name="line.3035"></a>
+<span class="sourceLineNo">3036</span>  public void updateConfiguration(final ServerName server) throws IOException {<a name="line.3036"></a>
+<span class="sourceLineNo">3037</span>    final AdminService.BlockingInterface admin = this.connection.getAdmin(server);<a name="line.3037"></a>
+<span class="sourceLineNo">3038</span>    Callable&lt;Void&gt; callable = new Callable&lt;Void&gt;() {<a name="line.3038"></a>
+<span class="sourceLineNo">3039</span>      @Override<a name="line.3039"></a>
+<span class="sourceLineNo">3040</span>      public Void call() throws Exception {<a name="line.3040"></a>
+<span class="sourceLineNo">3041</span>        admin.updateConfiguration(null, UpdateConfigurationRequest.getDefaultInstance());<a name="line.3041"></a>
+<span class="sourceLineNo">3042</span>        return null;<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>    ProtobufUtil.call(callable);<a name="line.3045"></a>
+<span class="sourceLineNo">3046</span>  }<a name="line.3046"></a>
+<span class="sourceLineNo">3047</span><a name="line.3047"></a>
+<span class="sourceLineNo">3048</span>  @Override<a name="line.3048"></a>
+<span class="sourceLineNo">3049</span>  public void updateConfiguration() throws IOException {<a name="line.3049"></a>
+<span class="sourceLineNo">3050</span>    for (ServerName server : this.getClusterStatus().getServers()) {<a name="line.3050"></a>
+<span class="sourceLineNo">3051</span>      updateConfiguration(server);<a name="line.3051"></a>
+<span class="sourceLineNo">3052</span>    }<a name="line.3052"></a>
+<span class="sourceLineNo">3053</span><a name="line.3053"></a>
+<span class="sourceLineNo">3054</span>    updateConfiguration(this.getClusterStatus().getMaster());<a name="line.3054"></a>
+<span class="sourceLineNo">3055</span><a name="line.3055"></a>
+<span class="sourceLineNo">3056</span>    for (ServerName server : this.getClusterStatus().getBackupMasters()) {<a name="line.3056"></a>
+<span class="sourceLineNo">3057</span>      updateConfiguration(server);<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><a name="line.3060"></a>
-<span class="sourceLineNo">3061</span>    updateConfiguration(this.getClusterStatus().getMaster());<a name="line.3061"></a>
-<span class="sourceLineNo">3062</span><a name="line.3062"></a>
-<span class="sourceLineNo">3063

<TRUNCATED>

Mime
View raw message