hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From git-site-r...@apache.org
Subject [08/51] [partial] hbase-site git commit: Published site at 82d554e3783372cc6b05489452c815b57c06f6cd.
Date Fri, 21 Apr 2017 15:01:20 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/10601a30/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 8c56a67..8e3d847 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
@@ -2506,1742 +2506,1743 @@
 <span class="sourceLineNo">2498</span>  public void restoreSnapshot(final String snapshotName)<a name="line.2498"></a>
 <span class="sourceLineNo">2499</span>      throws IOException, RestoreSnapshotException {<a name="line.2499"></a>
 <span class="sourceLineNo">2500</span>    boolean takeFailSafeSnapshot =<a name="line.2500"></a>
-<span class="sourceLineNo">2501</span>      conf.getBoolean("hbase.snapshot.restore.take.failsafe.snapshot", false);<a name="line.2501"></a>
-<span class="sourceLineNo">2502</span>    restoreSnapshot(snapshotName, takeFailSafeSnapshot);<a name="line.2502"></a>
-<span class="sourceLineNo">2503</span>  }<a name="line.2503"></a>
-<span class="sourceLineNo">2504</span><a name="line.2504"></a>
-<span class="sourceLineNo">2505</span>  @Override<a name="line.2505"></a>
-<span class="sourceLineNo">2506</span>  public void restoreSnapshot(final byte[] snapshotName, final boolean takeFailSafeSnapshot)<a name="line.2506"></a>
-<span class="sourceLineNo">2507</span>      throws IOException, RestoreSnapshotException {<a name="line.2507"></a>
-<span class="sourceLineNo">2508</span>    restoreSnapshot(Bytes.toString(snapshotName), takeFailSafeSnapshot);<a name="line.2508"></a>
-<span class="sourceLineNo">2509</span>  }<a name="line.2509"></a>
-<span class="sourceLineNo">2510</span><a name="line.2510"></a>
-<span class="sourceLineNo">2511</span>  /*<a name="line.2511"></a>
-<span class="sourceLineNo">2512</span>   * Check whether the snapshot exists and contains disabled table<a name="line.2512"></a>
-<span class="sourceLineNo">2513</span>   *<a name="line.2513"></a>
-<span class="sourceLineNo">2514</span>   * @param snapshotName name of the snapshot to restore<a name="line.2514"></a>
-<span class="sourceLineNo">2515</span>   * @throws IOException if a remote or network exception occurs<a name="line.2515"></a>
-<span class="sourceLineNo">2516</span>   * @throws RestoreSnapshotException if no valid snapshot is found<a name="line.2516"></a>
-<span class="sourceLineNo">2517</span>   */<a name="line.2517"></a>
-<span class="sourceLineNo">2518</span>  private TableName getTableNameBeforeRestoreSnapshot(final String snapshotName)<a name="line.2518"></a>
-<span class="sourceLineNo">2519</span>      throws IOException, RestoreSnapshotException {<a name="line.2519"></a>
-<span class="sourceLineNo">2520</span>    TableName tableName = null;<a name="line.2520"></a>
-<span class="sourceLineNo">2521</span>    for (SnapshotDescription snapshotInfo: listSnapshots()) {<a name="line.2521"></a>
-<span class="sourceLineNo">2522</span>      if (snapshotInfo.getName().equals(snapshotName)) {<a name="line.2522"></a>
-<span class="sourceLineNo">2523</span>        tableName = snapshotInfo.getTableName();<a name="line.2523"></a>
-<span class="sourceLineNo">2524</span>        break;<a name="line.2524"></a>
-<span class="sourceLineNo">2525</span>      }<a name="line.2525"></a>
-<span class="sourceLineNo">2526</span>    }<a name="line.2526"></a>
-<span class="sourceLineNo">2527</span><a name="line.2527"></a>
-<span class="sourceLineNo">2528</span>    if (tableName == null) {<a name="line.2528"></a>
-<span class="sourceLineNo">2529</span>      throw new RestoreSnapshotException(<a name="line.2529"></a>
-<span class="sourceLineNo">2530</span>        "Unable to find the table name for snapshot=" + snapshotName);<a name="line.2530"></a>
-<span class="sourceLineNo">2531</span>    }<a name="line.2531"></a>
-<span class="sourceLineNo">2532</span>    return tableName;<a name="line.2532"></a>
-<span class="sourceLineNo">2533</span>  }<a name="line.2533"></a>
-<span class="sourceLineNo">2534</span><a name="line.2534"></a>
-<span class="sourceLineNo">2535</span>  @Override<a name="line.2535"></a>
-<span class="sourceLineNo">2536</span>  public void restoreSnapshot(final String snapshotName, final boolean takeFailSafeSnapshot)<a name="line.2536"></a>
-<span class="sourceLineNo">2537</span>      throws IOException, RestoreSnapshotException {<a name="line.2537"></a>
-<span class="sourceLineNo">2538</span>    TableName tableName = getTableNameBeforeRestoreSnapshot(snapshotName);<a name="line.2538"></a>
-<span class="sourceLineNo">2539</span><a name="line.2539"></a>
-<span class="sourceLineNo">2540</span>    // The table does not exists, switch to clone.<a name="line.2540"></a>
-<span class="sourceLineNo">2541</span>    if (!tableExists(tableName)) {<a name="line.2541"></a>
-<span class="sourceLineNo">2542</span>      cloneSnapshot(snapshotName, tableName);<a name="line.2542"></a>
-<span class="sourceLineNo">2543</span>      return;<a name="line.2543"></a>
-<span class="sourceLineNo">2544</span>    }<a name="line.2544"></a>
-<span class="sourceLineNo">2545</span><a name="line.2545"></a>
-<span class="sourceLineNo">2546</span>    // Check if the table is disabled<a name="line.2546"></a>
-<span class="sourceLineNo">2547</span>    if (!isTableDisabled(tableName)) {<a name="line.2547"></a>
-<span class="sourceLineNo">2548</span>      throw new TableNotDisabledException(tableName);<a name="line.2548"></a>
-<span class="sourceLineNo">2549</span>    }<a name="line.2549"></a>
-<span class="sourceLineNo">2550</span><a name="line.2550"></a>
-<span class="sourceLineNo">2551</span>    // Take a snapshot of the current state<a name="line.2551"></a>
-<span class="sourceLineNo">2552</span>    String failSafeSnapshotSnapshotName = null;<a name="line.2552"></a>
-<span class="sourceLineNo">2553</span>    if (takeFailSafeSnapshot) {<a name="line.2553"></a>
-<span class="sourceLineNo">2554</span>      failSafeSnapshotSnapshotName = conf.get("hbase.snapshot.restore.failsafe.name",<a name="line.2554"></a>
-<span class="sourceLineNo">2555</span>        "hbase-failsafe-{snapshot.name}-{restore.timestamp}");<a name="line.2555"></a>
-<span class="sourceLineNo">2556</span>      failSafeSnapshotSnapshotName = failSafeSnapshotSnapshotName<a name="line.2556"></a>
-<span class="sourceLineNo">2557</span>        .replace("{snapshot.name}", snapshotName)<a name="line.2557"></a>
-<span class="sourceLineNo">2558</span>        .replace("{table.name}", tableName.toString().replace(TableName.NAMESPACE_DELIM, '.'))<a name="line.2558"></a>
-<span class="sourceLineNo">2559</span>        .replace("{restore.timestamp}", String.valueOf(EnvironmentEdgeManager.currentTime()));<a name="line.2559"></a>
-<span class="sourceLineNo">2560</span>      LOG.info("Taking restore-failsafe snapshot: " + failSafeSnapshotSnapshotName);<a name="line.2560"></a>
-<span class="sourceLineNo">2561</span>      snapshot(failSafeSnapshotSnapshotName, tableName);<a name="line.2561"></a>
-<span class="sourceLineNo">2562</span>    }<a name="line.2562"></a>
-<span class="sourceLineNo">2563</span><a name="line.2563"></a>
-<span class="sourceLineNo">2564</span>    try {<a name="line.2564"></a>
-<span class="sourceLineNo">2565</span>      // Restore snapshot<a name="line.2565"></a>
-<span class="sourceLineNo">2566</span>      get(<a name="line.2566"></a>
-<span class="sourceLineNo">2567</span>        internalRestoreSnapshotAsync(snapshotName, tableName),<a name="line.2567"></a>
-<span class="sourceLineNo">2568</span>        syncWaitTimeout,<a name="line.2568"></a>
-<span class="sourceLineNo">2569</span>        TimeUnit.MILLISECONDS);<a name="line.2569"></a>
-<span class="sourceLineNo">2570</span>    } catch (IOException e) {<a name="line.2570"></a>
-<span class="sourceLineNo">2571</span>      // Somthing went wrong during the restore...<a name="line.2571"></a>
-<span class="sourceLineNo">2572</span>      // if the pre-restore snapshot is available try to rollback<a name="line.2572"></a>
-<span class="sourceLineNo">2573</span>      if (takeFailSafeSnapshot) {<a name="line.2573"></a>
-<span class="sourceLineNo">2574</span>        try {<a name="line.2574"></a>
-<span class="sourceLineNo">2575</span>          get(<a name="line.2575"></a>
-<span class="sourceLineNo">2576</span>            internalRestoreSnapshotAsync(failSafeSnapshotSnapshotName, 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>          String msg = "Restore snapshot=" + snapshotName +<a name="line.2579"></a>
-<span class="sourceLineNo">2580</span>            " failed. Rollback to snapshot=" + failSafeSnapshotSnapshotName + " succeeded.";<a name="line.2580"></a>
-<span class="sourceLineNo">2581</span>          LOG.error(msg, e);<a name="line.2581"></a>
-<span class="sourceLineNo">2582</span>          throw new RestoreSnapshotException(msg, e);<a name="line.2582"></a>
-<span class="sourceLineNo">2583</span>        } catch (IOException ex) {<a name="line.2583"></a>
-<span class="sourceLineNo">2584</span>          String msg = "Failed to restore and rollback to snapshot=" + failSafeSnapshotSnapshotName;<a name="line.2584"></a>
-<span class="sourceLineNo">2585</span>          LOG.error(msg, ex);<a name="line.2585"></a>
-<span class="sourceLineNo">2586</span>          throw new RestoreSnapshotException(msg, e);<a name="line.2586"></a>
-<span class="sourceLineNo">2587</span>        }<a name="line.2587"></a>
-<span class="sourceLineNo">2588</span>      } else {<a name="line.2588"></a>
-<span class="sourceLineNo">2589</span>        throw new RestoreSnapshotException("Failed to restore snapshot=" + snapshotName, e);<a name="line.2589"></a>
-<span class="sourceLineNo">2590</span>      }<a name="line.2590"></a>
-<span class="sourceLineNo">2591</span>    }<a name="line.2591"></a>
-<span class="sourceLineNo">2592</span><a name="line.2592"></a>
-<span class="sourceLineNo">2593</span>    // If the restore is succeeded, delete the pre-restore snapshot<a name="line.2593"></a>
-<span class="sourceLineNo">2594</span>    if (takeFailSafeSnapshot) {<a name="line.2594"></a>
-<span class="sourceLineNo">2595</span>      try {<a name="line.2595"></a>
-<span class="sourceLineNo">2596</span>        LOG.info("Deleting restore-failsafe snapshot: " + failSafeSnapshotSnapshotName);<a name="line.2596"></a>
-<span class="sourceLineNo">2597</span>        deleteSnapshot(failSafeSnapshotSnapshotName);<a name="line.2597"></a>
-<span class="sourceLineNo">2598</span>      } catch (IOException e) {<a name="line.2598"></a>
-<span class="sourceLineNo">2599</span>        LOG.error("Unable to remove the failsafe snapshot: " + failSafeSnapshotSnapshotName, e);<a name="line.2599"></a>
-<span class="sourceLineNo">2600</span>      }<a name="line.2600"></a>
-<span class="sourceLineNo">2601</span>    }<a name="line.2601"></a>
-<span class="sourceLineNo">2602</span>  }<a name="line.2602"></a>
-<span class="sourceLineNo">2603</span><a name="line.2603"></a>
-<span class="sourceLineNo">2604</span>  @Override<a name="line.2604"></a>
-<span class="sourceLineNo">2605</span>  public Future&lt;Void&gt; restoreSnapshotAsync(final String snapshotName)<a name="line.2605"></a>
-<span class="sourceLineNo">2606</span>      throws IOException, RestoreSnapshotException {<a name="line.2606"></a>
-<span class="sourceLineNo">2607</span>    TableName tableName = getTableNameBeforeRestoreSnapshot(snapshotName);<a name="line.2607"></a>
-<span class="sourceLineNo">2608</span><a name="line.2608"></a>
-<span class="sourceLineNo">2609</span>    // The table does not exists, switch to clone.<a name="line.2609"></a>
-<span class="sourceLineNo">2610</span>    if (!tableExists(tableName)) {<a name="line.2610"></a>
-<span class="sourceLineNo">2611</span>      return cloneSnapshotAsync(snapshotName, tableName);<a name="line.2611"></a>
-<span class="sourceLineNo">2612</span>    }<a name="line.2612"></a>
-<span class="sourceLineNo">2613</span><a name="line.2613"></a>
-<span class="sourceLineNo">2614</span>    // Check if the table is disabled<a name="line.2614"></a>
-<span class="sourceLineNo">2615</span>    if (!isTableDisabled(tableName)) {<a name="line.2615"></a>
-<span class="sourceLineNo">2616</span>      throw new TableNotDisabledException(tableName);<a name="line.2616"></a>
-<span class="sourceLineNo">2617</span>    }<a name="line.2617"></a>
-<span class="sourceLineNo">2618</span><a name="line.2618"></a>
-<span class="sourceLineNo">2619</span>    return internalRestoreSnapshotAsync(snapshotName, tableName);<a name="line.2619"></a>
-<span class="sourceLineNo">2620</span>  }<a name="line.2620"></a>
-<span class="sourceLineNo">2621</span><a name="line.2621"></a>
-<span class="sourceLineNo">2622</span>  @Override<a name="line.2622"></a>
-<span class="sourceLineNo">2623</span>  public void cloneSnapshot(final byte[] snapshotName, final TableName tableName)<a name="line.2623"></a>
-<span class="sourceLineNo">2624</span>      throws IOException, TableExistsException, RestoreSnapshotException {<a name="line.2624"></a>
-<span class="sourceLineNo">2625</span>    cloneSnapshot(Bytes.toString(snapshotName), 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>  @Override<a name="line.2628"></a>
-<span class="sourceLineNo">2629</span>  public void cloneSnapshot(final String snapshotName, final TableName tableName)<a name="line.2629"></a>
-<span class="sourceLineNo">2630</span>      throws IOException, TableExistsException, RestoreSnapshotException {<a name="line.2630"></a>
-<span class="sourceLineNo">2631</span>    if (tableExists(tableName)) {<a name="line.2631"></a>
-<span class="sourceLineNo">2632</span>      throw new TableExistsException(tableName);<a name="line.2632"></a>
-<span class="sourceLineNo">2633</span>    }<a name="line.2633"></a>
-<span class="sourceLineNo">2634</span>    get(<a name="line.2634"></a>
-<span class="sourceLineNo">2635</span>      internalRestoreSnapshotAsync(snapshotName, tableName),<a name="line.2635"></a>
-<span class="sourceLineNo">2636</span>      Integer.MAX_VALUE,<a name="line.2636"></a>
-<span class="sourceLineNo">2637</span>      TimeUnit.MILLISECONDS);<a name="line.2637"></a>
-<span class="sourceLineNo">2638</span>  }<a name="line.2638"></a>
-<span class="sourceLineNo">2639</span><a name="line.2639"></a>
-<span class="sourceLineNo">2640</span>  @Override<a name="line.2640"></a>
-<span class="sourceLineNo">2641</span>  public Future&lt;Void&gt; cloneSnapshotAsync(final String snapshotName, final TableName tableName)<a name="line.2641"></a>
-<span class="sourceLineNo">2642</span>      throws IOException, TableExistsException {<a name="line.2642"></a>
-<span class="sourceLineNo">2643</span>    if (tableExists(tableName)) {<a name="line.2643"></a>
-<span class="sourceLineNo">2644</span>      throw new TableExistsException(tableName);<a name="line.2644"></a>
-<span class="sourceLineNo">2645</span>    }<a name="line.2645"></a>
-<span class="sourceLineNo">2646</span>    return internalRestoreSnapshotAsync(snapshotName, tableName);<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 byte[] execProcedureWithRet(String signature, String instance, Map&lt;String, String&gt; props)<a name="line.2650"></a>
-<span class="sourceLineNo">2651</span>      throws IOException {<a name="line.2651"></a>
-<span class="sourceLineNo">2652</span>    ProcedureDescription.Builder builder = ProcedureDescription.newBuilder();<a name="line.2652"></a>
-<span class="sourceLineNo">2653</span>    builder.setSignature(signature).setInstance(instance);<a name="line.2653"></a>
-<span class="sourceLineNo">2654</span>    for (Entry&lt;String, String&gt; entry : props.entrySet()) {<a name="line.2654"></a>
-<span class="sourceLineNo">2655</span>      NameStringPair pair = NameStringPair.newBuilder().setName(entry.getKey())<a name="line.2655"></a>
-<span class="sourceLineNo">2656</span>          .setValue(entry.getValue()).build();<a name="line.2656"></a>
-<span class="sourceLineNo">2657</span>      builder.addConfiguration(pair);<a name="line.2657"></a>
-<span class="sourceLineNo">2658</span>    }<a name="line.2658"></a>
-<span class="sourceLineNo">2659</span><a name="line.2659"></a>
-<span class="sourceLineNo">2660</span>    final ExecProcedureRequest request = ExecProcedureRequest.newBuilder()<a name="line.2660"></a>
-<span class="sourceLineNo">2661</span>        .setProcedure(builder.build()).build();<a name="line.2661"></a>
-<span class="sourceLineNo">2662</span>    // run the procedure on the master<a name="line.2662"></a>
-<span class="sourceLineNo">2663</span>    ExecProcedureResponse response = executeCallable(new MasterCallable&lt;ExecProcedureResponse&gt;(<a name="line.2663"></a>
-<span class="sourceLineNo">2664</span>        getConnection(), getRpcControllerFactory()) {<a name="line.2664"></a>
-<span class="sourceLineNo">2665</span>      @Override<a name="line.2665"></a>
-<span class="sourceLineNo">2666</span>      protected ExecProcedureResponse rpcCall() throws Exception {<a name="line.2666"></a>
-<span class="sourceLineNo">2667</span>        return master.execProcedureWithRet(getRpcController(), request);<a name="line.2667"></a>
-<span class="sourceLineNo">2668</span>      }<a name="line.2668"></a>
-<span class="sourceLineNo">2669</span>    });<a name="line.2669"></a>
-<span class="sourceLineNo">2670</span><a name="line.2670"></a>
-<span class="sourceLineNo">2671</span>    return response.hasReturnData() ? response.getReturnData().toByteArray() : null;<a name="line.2671"></a>
-<span class="sourceLineNo">2672</span>  }<a name="line.2672"></a>
-<span class="sourceLineNo">2673</span><a name="line.2673"></a>
-<span class="sourceLineNo">2674</span>  @Override<a name="line.2674"></a>
-<span class="sourceLineNo">2675</span>  public void execProcedure(String signature, String instance, Map&lt;String, String&gt; props)<a name="line.2675"></a>
-<span class="sourceLineNo">2676</span>      throws IOException {<a name="line.2676"></a>
-<span class="sourceLineNo">2677</span>    ProcedureDescription.Builder builder = ProcedureDescription.newBuilder();<a name="line.2677"></a>
-<span class="sourceLineNo">2678</span>    builder.setSignature(signature).setInstance(instance);<a name="line.2678"></a>
-<span class="sourceLineNo">2679</span>    for (Entry&lt;String, String&gt; entry : props.entrySet()) {<a name="line.2679"></a>
-<span class="sourceLineNo">2680</span>      NameStringPair pair = NameStringPair.newBuilder().setName(entry.getKey())<a name="line.2680"></a>
-<span class="sourceLineNo">2681</span>          .setValue(entry.getValue()).build();<a name="line.2681"></a>
-<span class="sourceLineNo">2682</span>      builder.addConfiguration(pair);<a name="line.2682"></a>
-<span class="sourceLineNo">2683</span>    }<a name="line.2683"></a>
-<span class="sourceLineNo">2684</span><a name="line.2684"></a>
-<span class="sourceLineNo">2685</span>    final ExecProcedureRequest request = ExecProcedureRequest.newBuilder()<a name="line.2685"></a>
-<span class="sourceLineNo">2686</span>        .setProcedure(builder.build()).build();<a name="line.2686"></a>
-<span class="sourceLineNo">2687</span>    // run the procedure on the master<a name="line.2687"></a>
-<span class="sourceLineNo">2688</span>    ExecProcedureResponse response = executeCallable(new MasterCallable&lt;ExecProcedureResponse&gt;(<a name="line.2688"></a>
-<span class="sourceLineNo">2689</span>        getConnection(), getRpcControllerFactory()) {<a name="line.2689"></a>
-<span class="sourceLineNo">2690</span>      @Override<a name="line.2690"></a>
-<span class="sourceLineNo">2691</span>      protected ExecProcedureResponse rpcCall() throws Exception {<a name="line.2691"></a>
-<span class="sourceLineNo">2692</span>        return master.execProcedure(getRpcController(), request);<a name="line.2692"></a>
-<span class="sourceLineNo">2693</span>      }<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>    long start = EnvironmentEdgeManager.currentTime();<a name="line.2696"></a>
-<span class="sourceLineNo">2697</span>    long max = response.getExpectedTimeout();<a name="line.2697"></a>
-<span class="sourceLineNo">2698</span>    long maxPauseTime = max / this.numRetries;<a name="line.2698"></a>
-<span class="sourceLineNo">2699</span>    int tries = 0;<a name="line.2699"></a>
-<span class="sourceLineNo">2700</span>    LOG.debug("Waiting a max of " + max + " ms for procedure '" +<a name="line.2700"></a>
-<span class="sourceLineNo">2701</span>        signature + " : " + instance + "'' to complete. (max " + maxPauseTime + " ms per retry)");<a name="line.2701"></a>
-<span class="sourceLineNo">2702</span>    boolean done = false;<a name="line.2702"></a>
-<span class="sourceLineNo">2703</span>    while (tries == 0<a name="line.2703"></a>
-<span class="sourceLineNo">2704</span>        || ((EnvironmentEdgeManager.currentTime() - start) &lt; max &amp;&amp; !done)) {<a name="line.2704"></a>
-<span class="sourceLineNo">2705</span>      try {<a name="line.2705"></a>
-<span class="sourceLineNo">2706</span>        // sleep a backoff &lt;= pauseTime amount<a name="line.2706"></a>
-<span class="sourceLineNo">2707</span>        long sleep = getPauseTime(tries++);<a name="line.2707"></a>
-<span class="sourceLineNo">2708</span>        sleep = sleep &gt; maxPauseTime ? maxPauseTime : sleep;<a name="line.2708"></a>
-<span class="sourceLineNo">2709</span>        LOG.debug("(#" + tries + ") Sleeping: " + sleep +<a name="line.2709"></a>
-<span class="sourceLineNo">2710</span>          "ms while waiting for procedure completion.");<a name="line.2710"></a>
-<span class="sourceLineNo">2711</span>        Thread.sleep(sleep);<a name="line.2711"></a>
-<span class="sourceLineNo">2712</span>      } catch (InterruptedException e) {<a name="line.2712"></a>
-<span class="sourceLineNo">2713</span>        throw (InterruptedIOException)new InterruptedIOException("Interrupted").initCause(e);<a name="line.2713"></a>
-<span class="sourceLineNo">2714</span>      }<a name="line.2714"></a>
-<span class="sourceLineNo">2715</span>      LOG.debug("Getting current status of procedure from master...");<a name="line.2715"></a>
-<span class="sourceLineNo">2716</span>      done = isProcedureFinished(signature, instance, props);<a name="line.2716"></a>
-<span class="sourceLineNo">2717</span>    }<a name="line.2717"></a>
-<span class="sourceLineNo">2718</span>    if (!done) {<a name="line.2718"></a>
-<span class="sourceLineNo">2719</span>      throw new IOException("Procedure '" + signature + " : " + instance<a name="line.2719"></a>
-<span class="sourceLineNo">2720</span>          + "' wasn't completed in expectedTime:" + max + " ms");<a name="line.2720"></a>
-<span class="sourceLineNo">2721</span>    }<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>  @Override<a name="line.2724"></a>
-<span class="sourceLineNo">2725</span>  public boolean isProcedureFinished(String signature, String instance, Map&lt;String, String&gt; props)<a name="line.2725"></a>
-<span class="sourceLineNo">2726</span>      throws IOException {<a name="line.2726"></a>
-<span class="sourceLineNo">2727</span>    final ProcedureDescription.Builder builder = ProcedureDescription.newBuilder();<a name="line.2727"></a>
-<span class="sourceLineNo">2728</span>    builder.setSignature(signature).setInstance(instance);<a name="line.2728"></a>
-<span class="sourceLineNo">2729</span>    for (Entry&lt;String, String&gt; entry : props.entrySet()) {<a name="line.2729"></a>
-<span class="sourceLineNo">2730</span>      NameStringPair pair = NameStringPair.newBuilder().setName(entry.getKey())<a name="line.2730"></a>
-<span class="sourceLineNo">2731</span>          .setValue(entry.getValue()).build();<a name="line.2731"></a>
-<span class="sourceLineNo">2732</span>      builder.addConfiguration(pair);<a name="line.2732"></a>
-<span class="sourceLineNo">2733</span>    }<a name="line.2733"></a>
-<span class="sourceLineNo">2734</span>    final ProcedureDescription desc = builder.build();<a name="line.2734"></a>
-<span class="sourceLineNo">2735</span>    return executeCallable(<a name="line.2735"></a>
-<span class="sourceLineNo">2736</span>        new MasterCallable&lt;IsProcedureDoneResponse&gt;(getConnection(), getRpcControllerFactory()) {<a name="line.2736"></a>
-<span class="sourceLineNo">2737</span>          @Override<a name="line.2737"></a>
-<span class="sourceLineNo">2738</span>          protected IsProcedureDoneResponse rpcCall() throws Exception {<a name="line.2738"></a>
-<span class="sourceLineNo">2739</span>            return master.isProcedureDone(getRpcController(), IsProcedureDoneRequest<a name="line.2739"></a>
-<span class="sourceLineNo">2740</span>                .newBuilder().setProcedure(desc).build());<a name="line.2740"></a>
-<span class="sourceLineNo">2741</span>          }<a name="line.2741"></a>
-<span class="sourceLineNo">2742</span>        }).getDone();<a name="line.2742"></a>
-<span class="sourceLineNo">2743</span>  }<a name="line.2743"></a>
-<span class="sourceLineNo">2744</span><a name="line.2744"></a>
-<span class="sourceLineNo">2745</span>  /**<a name="line.2745"></a>
-<span class="sourceLineNo">2746</span>   * Execute Restore/Clone snapshot and wait for the server to complete (blocking).<a name="line.2746"></a>
-<span class="sourceLineNo">2747</span>   * To check if the cloned table exists, use {@link #isTableAvailable} -- it is not safe to<a name="line.2747"></a>
-<span class="sourceLineNo">2748</span>   * create an HTable instance to this table before it is available.<a name="line.2748"></a>
-<span class="sourceLineNo">2749</span>   * @param snapshotName snapshot to restore<a name="line.2749"></a>
-<span class="sourceLineNo">2750</span>   * @param tableName table name to restore the snapshot on<a name="line.2750"></a>
-<span class="sourceLineNo">2751</span>   * @throws IOException if a remote or network exception occurs<a name="line.2751"></a>
-<span class="sourceLineNo">2752</span>   * @throws RestoreSnapshotException if snapshot failed to be restored<a name="line.2752"></a>
-<span class="sourceLineNo">2753</span>   * @throws IllegalArgumentException if the restore request is formatted incorrectly<a name="line.2753"></a>
-<span class="sourceLineNo">2754</span>   */<a name="line.2754"></a>
-<span class="sourceLineNo">2755</span>  private Future&lt;Void&gt; internalRestoreSnapshotAsync(<a name="line.2755"></a>
-<span class="sourceLineNo">2756</span>      final String snapshotName,<a name="line.2756"></a>
-<span class="sourceLineNo">2757</span>      final TableName tableName) throws IOException, RestoreSnapshotException {<a name="line.2757"></a>
-<span class="sourceLineNo">2758</span>    final HBaseProtos.SnapshotDescription snapshot = HBaseProtos.SnapshotDescription.newBuilder()<a name="line.2758"></a>
-<span class="sourceLineNo">2759</span>        .setName(snapshotName).setTable(tableName.getNameAsString()).build();<a name="line.2759"></a>
-<span class="sourceLineNo">2760</span><a name="line.2760"></a>
-<span class="sourceLineNo">2761</span>    // actually restore the snapshot<a name="line.2761"></a>
-<span class="sourceLineNo">2762</span>    ClientSnapshotDescriptionUtils.assertSnapshotRequestIsValid(snapshot);<a name="line.2762"></a>
-<span class="sourceLineNo">2763</span><a name="line.2763"></a>
-<span class="sourceLineNo">2764</span>    RestoreSnapshotResponse response = executeCallable(<a name="line.2764"></a>
-<span class="sourceLineNo">2765</span>        new MasterCallable&lt;RestoreSnapshotResponse&gt;(getConnection(), getRpcControllerFactory()) {<a name="line.2765"></a>
-<span class="sourceLineNo">2766</span>      @Override<a name="line.2766"></a>
-<span class="sourceLineNo">2767</span>      protected RestoreSnapshotResponse rpcCall() throws Exception {<a name="line.2767"></a>
-<span class="sourceLineNo">2768</span>        final RestoreSnapshotRequest request = RestoreSnapshotRequest.newBuilder()<a name="line.2768"></a>
-<span class="sourceLineNo">2769</span>            .setSnapshot(snapshot)<a name="line.2769"></a>
-<span class="sourceLineNo">2770</span>            .setNonceGroup(ng.getNonceGroup())<a name="line.2770"></a>
-<span class="sourceLineNo">2771</span>            .setNonce(ng.newNonce())<a name="line.2771"></a>
-<span class="sourceLineNo">2772</span>            .build();<a name="line.2772"></a>
-<span class="sourceLineNo">2773</span>        return master.restoreSnapshot(getRpcController(), request);<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><a name="line.2776"></a>
-<span class="sourceLineNo">2777</span>    return new RestoreSnapshotFuture(this, snapshot, tableName, response);<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>  private static class RestoreSnapshotFuture extends TableFuture&lt;Void&gt; {<a name="line.2780"></a>
-<span class="sourceLineNo">2781</span>    public RestoreSnapshotFuture(<a name="line.2781"></a>
-<span class="sourceLineNo">2782</span>        final HBaseAdmin admin,<a name="line.2782"></a>
-<span class="sourceLineNo">2783</span>        final HBaseProtos.SnapshotDescription snapshot,<a name="line.2783"></a>
-<span class="sourceLineNo">2784</span>        final TableName tableName,<a name="line.2784"></a>
-<span class="sourceLineNo">2785</span>        final RestoreSnapshotResponse response) {<a name="line.2785"></a>
-<span class="sourceLineNo">2786</span>      super(admin, tableName,<a name="line.2786"></a>
-<span class="sourceLineNo">2787</span>          (response != null &amp;&amp; response.hasProcId()) ? response.getProcId() : null);<a name="line.2787"></a>
-<span class="sourceLineNo">2788</span><a name="line.2788"></a>
-<span class="sourceLineNo">2789</span>      if (response != null &amp;&amp; !response.hasProcId()) {<a name="line.2789"></a>
-<span class="sourceLineNo">2790</span>        throw new UnsupportedOperationException("Client could not call old version of Server");<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><a name="line.2793"></a>
-<span class="sourceLineNo">2794</span>    public RestoreSnapshotFuture(<a name="line.2794"></a>
-<span class="sourceLineNo">2795</span>        final HBaseAdmin admin,<a name="line.2795"></a>
-<span class="sourceLineNo">2796</span>        final TableName tableName,<a name="line.2796"></a>
-<span class="sourceLineNo">2797</span>        final Long procId) {<a name="line.2797"></a>
-<span class="sourceLineNo">2798</span>      super(admin, tableName, procId);<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>    @Override<a name="line.2801"></a>
-<span class="sourceLineNo">2802</span>    public String getOperationType() {<a name="line.2802"></a>
-<span class="sourceLineNo">2803</span>      return "MODIFY";<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><a name="line.2806"></a>
-<span class="sourceLineNo">2807</span>  @Override<a name="line.2807"></a>
-<span class="sourceLineNo">2808</span>  public List&lt;SnapshotDescription&gt; listSnapshots() throws IOException {<a name="line.2808"></a>
-<span class="sourceLineNo">2809</span>    return executeCallable(new MasterCallable&lt;List&lt;SnapshotDescription&gt;&gt;(getConnection(),<a name="line.2809"></a>
-<span class="sourceLineNo">2810</span>        getRpcControllerFactory()) {<a name="line.2810"></a>
-<span class="sourceLineNo">2811</span>      @Override<a name="line.2811"></a>
-<span class="sourceLineNo">2812</span>      protected List&lt;SnapshotDescription&gt; rpcCall() throws Exception {<a name="line.2812"></a>
-<span class="sourceLineNo">2813</span>        List&lt;HBaseProtos.SnapshotDescription&gt; snapshotsList = master<a name="line.2813"></a>
-<span class="sourceLineNo">2814</span>            .getCompletedSnapshots(getRpcController(),<a name="line.2814"></a>
-<span class="sourceLineNo">2815</span>                GetCompletedSnapshotsRequest.newBuilder().build())<a name="line.2815"></a>
-<span class="sourceLineNo">2816</span>            .getSnapshotsList();<a name="line.2816"></a>
-<span class="sourceLineNo">2817</span>        List&lt;SnapshotDescription&gt; result = new ArrayList&lt;&gt;(snapshotsList.size());<a name="line.2817"></a>
-<span class="sourceLineNo">2818</span>        for (HBaseProtos.SnapshotDescription snapshot : snapshotsList) {<a name="line.2818"></a>
-<span class="sourceLineNo">2819</span>          result.add(ProtobufUtil.createSnapshotDesc(snapshot));<a name="line.2819"></a>
-<span class="sourceLineNo">2820</span>        }<a name="line.2820"></a>
-<span class="sourceLineNo">2821</span>        return result;<a name="line.2821"></a>
-<span class="sourceLineNo">2822</span>      }<a name="line.2822"></a>
-<span class="sourceLineNo">2823</span>    });<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(String regex) throws IOException {<a name="line.2827"></a>
-<span class="sourceLineNo">2828</span>    return listSnapshots(Pattern.compile(regex));<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; listSnapshots(Pattern pattern) throws IOException {<a name="line.2832"></a>
-<span class="sourceLineNo">2833</span>    List&lt;SnapshotDescription&gt; matched = new LinkedList&lt;&gt;();<a name="line.2833"></a>
-<span class="sourceLineNo">2834</span>    List&lt;SnapshotDescription&gt; snapshots = listSnapshots();<a name="line.2834"></a>
-<span class="sourceLineNo">2835</span>    for (SnapshotDescription snapshot : snapshots) {<a name="line.2835"></a>
-<span class="sourceLineNo">2836</span>      if (pattern.matcher(snapshot.getName()).matches()) {<a name="line.2836"></a>
-<span class="sourceLineNo">2837</span>        matched.add(snapshot);<a name="line.2837"></a>
-<span class="sourceLineNo">2838</span>      }<a name="line.2838"></a>
-<span class="sourceLineNo">2839</span>    }<a name="line.2839"></a>
-<span class="sourceLineNo">2840</span>    return matched;<a name="line.2840"></a>
-<span class="sourceLineNo">2841</span>  }<a name="line.2841"></a>
-<span class="sourceLineNo">2842</span><a name="line.2842"></a>
-<span class="sourceLineNo">2843</span>  @Override<a name="line.2843"></a>
-<span class="sourceLineNo">2844</span>  public List&lt;SnapshotDescription&gt; listTableSnapshots(String tableNameRegex,<a name="line.2844"></a>
-<span class="sourceLineNo">2845</span>      String snapshotNameRegex) throws IOException {<a name="line.2845"></a>
-<span class="sourceLineNo">2846</span>    return listTableSnapshots(Pattern.compile(tableNameRegex), Pattern.compile(snapshotNameRegex));<a name="line.2846"></a>
-<span class="sourceLineNo">2847</span>  }<a name="line.2847"></a>
-<span class="sourceLineNo">2848</span><a name="line.2848"></a>
-<span class="sourceLineNo">2849</span>  @Override<a name="line.2849"></a>
-<span class="sourceLineNo">2850</span>  public List&lt;SnapshotDescription&gt; listTableSnapshots(Pattern tableNamePattern,<a name="line.2850"></a>
-<span class="sourceLineNo">2851</span>      Pattern snapshotNamePattern) throws IOException {<a name="line.2851"></a>
-<span class="sourceLineNo">2852</span>    TableName[] tableNames = listTableNames(tableNamePattern);<a name="line.2852"></a>
-<span class="sourceLineNo">2853</span><a name="line.2853"></a>
-<span class="sourceLineNo">2854</span>    List&lt;SnapshotDescription&gt; tableSnapshots = new LinkedList&lt;&gt;();<a name="line.2854"></a>
-<span class="sourceLineNo">2855</span>    List&lt;SnapshotDescription&gt; snapshots = listSnapshots(snapshotNamePattern);<a name="line.2855"></a>
-<span class="sourceLineNo">2856</span><a name="line.2856"></a>
-<span class="sourceLineNo">2857</span>    List&lt;TableName&gt; listOfTableNames = Arrays.asList(tableNames);<a name="line.2857"></a>
-<span class="sourceLineNo">2858</span>    for (SnapshotDescription snapshot : snapshots) {<a name="line.2858"></a>
-<span class="sourceLineNo">2859</span>      if (listOfTableNames.contains(snapshot.getTableName())) {<a name="line.2859"></a>
-<span class="sourceLineNo">2860</span>        tableSnapshots.add(snapshot);<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>    return tableSnapshots;<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 byte[] snapshotName) throws IOException {<a name="line.2867"></a>
-<span class="sourceLineNo">2868</span>    deleteSnapshot(Bytes.toString(snapshotName));<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>  @Override<a name="line.2871"></a>
-<span class="sourceLineNo">2872</span>  public void deleteSnapshot(final String snapshotName) throws IOException {<a name="line.2872"></a>
-<span class="sourceLineNo">2873</span>    // make sure the snapshot is possibly valid<a name="line.2873"></a>
-<span class="sourceLineNo">2874</span>    TableName.isLegalFullyQualifiedTableName(Bytes.toBytes(snapshotName));<a name="line.2874"></a>
-<span class="sourceLineNo">2875</span>    // do the delete<a name="line.2875"></a>
-<span class="sourceLineNo">2876</span>    executeCallable(new MasterCallable&lt;Void&gt;(getConnection(), getRpcControllerFactory()) {<a name="line.2876"></a>
-<span class="sourceLineNo">2877</span>      @Override<a name="line.2877"></a>
-<span class="sourceLineNo">2878</span>      protected Void rpcCall() throws Exception {<a name="line.2878"></a>
-<span class="sourceLineNo">2879</span>        master.deleteSnapshot(getRpcController(),<a name="line.2879"></a>
-<span class="sourceLineNo">2880</span>          DeleteSnapshotRequest.newBuilder().setSnapshot(<a name="line.2880"></a>
-<span class="sourceLineNo">2881</span>                HBaseProtos.SnapshotDescription.newBuilder().setName(snapshotName).build())<a name="line.2881"></a>
-<span class="sourceLineNo">2882</span>              .build()<a name="line.2882"></a>
-<span class="sourceLineNo">2883</span>        );<a name="line.2883"></a>
-<span class="sourceLineNo">2884</span>        return null;<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>  }<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 String regex) throws IOException {<a name="line.2890"></a>
-<span class="sourceLineNo">2891</span>    deleteSnapshots(Pattern.compile(regex));<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>  @Override<a name="line.2894"></a>
-<span class="sourceLineNo">2895</span>  public void deleteSnapshots(final Pattern pattern) throws IOException {<a name="line.2895"></a>
-<span class="sourceLineNo">2896</span>    List&lt;SnapshotDescription&gt; snapshots = listSnapshots(pattern);<a name="line.2896"></a>
-<span class="sourceLineNo">2897</span>    for (final SnapshotDescription snapshot : snapshots) {<a name="line.2897"></a>
-<span class="sourceLineNo">2898</span>      try {<a name="line.2898"></a>
-<span class="sourceLineNo">2899</span>        internalDeleteSnapshot(snapshot);<a name="line.2899"></a>
-<span class="sourceLineNo">2900</span>      } catch (IOException ex) {<a name="line.2900"></a>
-<span class="sourceLineNo">2901</span>        LOG.info(<a name="line.2901"></a>
-<span class="sourceLineNo">2902</span>          "Failed to delete snapshot " + snapshot.getName() + " for table " + snapshot.getTableNameAsString(),<a name="line.2902"></a>
-<span class="sourceLineNo">2903</span>          ex);<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><a name="line.2907"></a>
-<span class="sourceLineNo">2908</span>  private void internalDeleteSnapshot(final SnapshotDescription snapshot) throws IOException {<a name="line.2908"></a>
-<span class="sourceLineNo">2909</span>    executeCallable(new MasterCallable&lt;Void&gt;(getConnection(), getRpcControllerFactory()) {<a name="line.2909"></a>
-<span class="sourceLineNo">2910</span>      @Override<a name="line.2910"></a>
-<span class="sourceLineNo">2911</span>      protected Void rpcCall() throws Exception {<a name="line.2911"></a>
-<span class="sourceLineNo">2912</span>        this.master.deleteSnapshot(getRpcController(), DeleteSnapshotRequest.newBuilder()<a name="line.2912"></a>
-<span class="sourceLineNo">2913</span>          .setSnapshot(ProtobufUtil.createHBaseProtosSnapshotDesc(snapshot)).build());<a name="line.2913"></a>
-<span class="sourceLineNo">2914</span>        return null;<a name="line.2914"></a>
-<span class="sourceLineNo">2915</span>      }<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><a name="line.2918"></a>
-<span class="sourceLineNo">2919</span>  @Override<a name="line.2919"></a>
-<span class="sourceLineNo">2920</span>  public void deleteTableSnapshots(String tableNameRegex, String snapshotNameRegex)<a name="line.2920"></a>
-<span class="sourceLineNo">2921</span>      throws IOException {<a name="line.2921"></a>
-<span class="sourceLineNo">2922</span>    deleteTableSnapshots(Pattern.compile(tableNameRegex), Pattern.compile(snapshotNameRegex));<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>  @Override<a name="line.2925"></a>
-<span class="sourceLineNo">2926</span>  public void deleteTableSnapshots(Pattern tableNamePattern, Pattern snapshotNamePattern)<a name="line.2926"></a>
-<span class="sourceLineNo">2927</span>      throws IOException {<a name="line.2927"></a>
-<span class="sourceLineNo">2928</span>    List&lt;SnapshotDescription&gt; snapshots = listTableSnapshots(tableNamePattern, snapshotNamePattern);<a name="line.2928"></a>
-<span class="sourceLineNo">2929</span>    for (SnapshotDescription snapshot : snapshots) {<a name="line.2929"></a>
-<span class="sourceLineNo">2930</span>      try {<a name="line.2930"></a>
-<span class="sourceLineNo">2931</span>        internalDeleteSnapshot(snapshot);<a name="line.2931"></a>
-<span class="sourceLineNo">2932</span>        LOG.debug("Successfully deleted snapshot: " + snapshot.getName());<a name="line.2932"></a>
-<span class="sourceLineNo">2933</span>      } catch (IOException e) {<a name="line.2933"></a>
-<span class="sourceLineNo">2934</span>        LOG.error("Failed to delete snapshot: " + snapshot.getName(), e);<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><a name="line.2938"></a>
-<span class="sourceLineNo">2939</span>  @Override<a name="line.2939"></a>
-<span class="sourceLineNo">2940</span>  public void setQuota(final QuotaSettings quota) throws IOException {<a name="line.2940"></a>
-<span class="sourceLineNo">2941</span>    executeCallable(new MasterCallable&lt;Void&gt;(getConnection(), getRpcControllerFactory()) {<a name="line.2941"></a>
-<span class="sourceLineNo">2942</span>      @Override<a name="line.2942"></a>
-<span class="sourceLineNo">2943</span>      protected Void rpcCall() throws Exception {<a name="line.2943"></a>
-<span class="sourceLineNo">2944</span>        this.master.setQuota(getRpcController(), QuotaSettings.buildSetQuotaRequestProto(quota));<a name="line.2944"></a>
-<span class="sourceLineNo">2945</span>        return null;<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>  }<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>  public QuotaRetriever getQuotaRetriever(final QuotaFilter filter) throws IOException {<a name="line.2951"></a>
-<span class="sourceLineNo">2952</span>    return QuotaRetriever.open(conf, filter);<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>  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>      throws IOException {<a name="line.2956"></a>
-<span class="sourceLineNo">2957</span>    return executeCallable(callable, rpcCallerFactory, operationTimeout, rpcTimeout);<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>  static private &lt;C extends RetryingCallable&lt;V&gt; &amp; Closeable, V&gt; V executeCallable(C callable,<a name="line.2960"></a>
-<span class="sourceLineNo">2961</span>             RpcRetryingCallerFactory rpcCallerFactory, int operationTimeout, int rpcTimeout)<a name="line.2961"></a>
-<span class="sourceLineNo">2962</span>  throws IOException {<a name="line.2962"></a>
-<span class="sourceLineNo">2963</span>    RpcRetryingCaller&lt;V&gt; caller = rpcCallerFactory.newCaller(rpcTimeout);<a name="line.2963"></a>
-<span class="sourceLineNo">2964</span>    try {<a name="line.2964"></a>
-<span class="sourceLineNo">2965</span>      return caller.callWithRetries(callable, operationTimeout);<a name="line.2965"></a>
-<span class="sourceLineNo">2966</span>    } finally {<a name="line.2966"></a>
-<span class="sourceLineNo">2967</span>      callable.close();<a name="line.2967"></a>
-<span class="sourceLineNo">2968</span>    }<a name="line.2968"></a>
-<span class="sourceLineNo">2969</span>  }<a name="line.2969"></a>
-<span class="sourceLineNo">2970</span><a name="line.2970"></a>
-<span class="sourceLineNo">2971</span>  @Override<a name="line.2971"></a>
-<span class="sourceLineNo">2972</span>  // Coprocessor Endpoint against the Master.<a name="line.2972"></a>
-<span class="sourceLineNo">2973</span>  public CoprocessorRpcChannel coprocessorService() {<a name="line.2973"></a>
-<span class="sourceLineNo">2974</span>    return new SyncCoprocessorRpcChannel() {<a name="line.2974"></a>
-<span class="sourceLineNo">2975</span>      @Override<a name="line.2975"></a>
-<span class="sourceLineNo">2976</span>      protected Message callExecService(final RpcController controller,<a name="line.2976"></a>
-<span class="sourceLineNo">2977</span>          final Descriptors.MethodDescriptor method, final Message request,<a name="line.2977"></a>
-<span class="sourceLineNo">2978</span>          final Message responsePrototype)<a name="line.2978"></a>
-<span class="sourceLineNo">2979</span>      throws IOException {<a name="line.2979"></a>
-<span class="sourceLineNo">2980</span>        if (LOG.isTraceEnabled()) {<a name="line.2980"></a>
-<span class="sourceLineNo">2981</span>          LOG.trace("Call: " + method.getName() + ", " + request.toString());<a name="line.2981"></a>
-<span class="sourceLineNo">2982</span>        }<a name="line.2982"></a>
-<span class="sourceLineNo">2983</span>        // Try-with-resources so close gets called when we are done.<a name="line.2983"></a>
-<span class="sourceLineNo">2984</span>        try (MasterCallable&lt;CoprocessorServiceResponse&gt; callable =<a name="line.2984"></a>
-<span class="sourceLineNo">2985</span>            new MasterCallable&lt;CoprocessorServiceResponse&gt;(connection,<a name="line.2985"></a>
-<span class="sourceLineNo">2986</span>                connection.getRpcControllerFactory()) {<a name="line.2986"></a>
-<span class="sourceLineNo">2987</span>          @Override<a name="line.2987"></a>
-<span class="sourceLineNo">2988</span>          protected CoprocessorServiceResponse rpcCall() throws Exception {<a name="line.2988"></a>
-<span class="sourceLineNo">2989</span>            CoprocessorServiceRequest csr =<a name="line.2989"></a>
-<span class="sourceLineNo">2990</span>                CoprocessorRpcUtils.getCoprocessorServiceRequest(method, request);<a name="line.2990"></a>
-<span class="sourceLineNo">2991</span>            return this.master.execMasterService(getRpcController(), csr);<a name="line.2991"></a>
-<span class="sourceLineNo">2992</span>          }<a name="line.2992"></a>
-<span class="sourceLineNo">2993</span>        };) {<a name="line.2993"></a>
-<span class="sourceLineNo">2994</span>          // TODO: Are we retrying here? Does not seem so. We should use RetryingRpcCaller<a name="line.2994"></a>
-<span class="sourceLineNo">2995</span>          callable.prepare(false);<a name="line.2995"></a>
-<span class="sourceLineNo">2996</span>          int operationTimeout = connection.getConnectionConfiguration().getOperationTimeout();<a name="line.2996"></a>
-<span class="sourceLineNo">2997</span>          CoprocessorServiceResponse result = callable.call(operationTimeout);<a name="line.2997"></a>
-<span class="sourceLineNo">2998</span>          return CoprocessorRpcUtils.getResponse(result, responsePrototype);<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>    };<a name="line.3001"></a>
-<span class="sourceLineNo">3002</span>  }<a name="line.3002"></a>
-<span class="sourceLineNo">3003</span><a name="line.3003"></a>
-<span class="sourceLineNo">3004</span>  /**<a name="line.3004"></a>
-<span class="sourceLineNo">3005</span>   * Simple {@link Abortable}, throwing RuntimeException on abort.<a name="line.3005"></a>
-<span class="sourceLineNo">3006</span>   */<a name="line.3006"></a>
-<span class="sourceLineNo">3007</span>  private static class ThrowableAbortable implements Abortable {<a name="line.3007"></a>
-<span class="sourceLineNo">3008</span>    @Override<a name="line.3008"></a>
-<span class="sourceLineNo">3009</span>    public void abort(String why, Throwable e) {<a name="line.3009"></a>
-<span class="sourceLineNo">3010</span>      throw new RuntimeException(why, e);<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>    @Override<a name="line.3013"></a>
-<span class="sourceLineNo">3014</span>    public boolean isAborted() {<a name="line.3014"></a>
-<span class="sourceLineNo">3015</span>      return true;<a name="line.3015"></a>
-<span class="sourceLineNo">3016</span>    }<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 CoprocessorRpcChannel coprocessorService(final ServerName serverName) {<a name="line.3020"></a>
-<span class="sourceLineNo">3021</span>    return new SyncCoprocessorRpcChannel() {<a name="line.3021"></a>
-<span class="sourceLineNo">3022</span>      @Override<a name="line.3022"></a>
-<span class="sourceLineNo">3023</span>      protected Message callExecService(RpcController controller,<a name="line.3023"></a>
-<span class="sourceLineNo">3024</span>          Descriptors.MethodDescriptor method, Message request, Message responsePrototype)<a name="line.3024"></a>
-<span class="sourceLineNo">3025</span>      throws IOException {<a name="line.3025"></a>
-<span class="sourceLineNo">3026</span>        if (LOG.isTraceEnabled()) {<a name="line.3026"></a>
-<span class="sourceLineNo">3027</span>          LOG.trace("Call: " + method.getName() + ", " + request.toString());<a name="line.3027"></a>
-<span class="sourceLineNo">3028</span>        }<a name="line.3028"></a>
-<span class="sourceLineNo">3029</span>        CoprocessorServiceRequest csr =<a name="line.3029"></a>
-<span class="sourceLineNo">3030</span>            CoprocessorRpcUtils.getCoprocessorServiceRequest(method, request);<a name="line.3030"></a>
-<span class="sourceLineNo">3031</span>        // TODO: Are we retrying here? Does not seem so. We should use RetryingRpcCaller<a name="line.3031"></a>
-<span class="sourceLineNo">3032</span>        // TODO: Make this same as RegionCoprocessorRpcChannel and MasterCoprocessorRpcChannel. They<a name="line.3032"></a>
-<span class="sourceLineNo">3033</span>        // are all different though should do same thing; e.g. RpcChannel setup.<a name="line.3033"></a>
-<span class="sourceLineNo">3034</span>        ClientProtos.ClientService.BlockingInterface stub = connection.getClient(serverName);<a name="line.3034"></a>
-<span class="sourceLineNo">3035</span>        CoprocessorServiceResponse result;<a name="line.3035"></a>
-<span class="sourceLineNo">3036</span>        try {<a name="line.3036"></a>
-<span class="sourceLineNo">3037</span>          result = stub.<a name="line.3037"></a>
-<span class="sourceLineNo">3038</span>              execRegionServerService(connection.getRpcControllerFactory().newController(), csr);<a name="line.3038"></a>
-<span class="sourceLineNo">3039</span>          return CoprocessorRpcUtils.getResponse(result, responsePrototype);<a name="line.3039"></a>
-<span class="sourceLineNo">3040</span>        } catch (ServiceException e) {<a name="line.3040"></a>
-<span class="sourceLineNo">3041</span>          throw ProtobufUtil.handleRemoteException(e);<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>    };<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 void updateConfiguration(final ServerName server) throws IOException {<a name="line.3048"></a>
-<span class="sourceLineNo">3049</span>    final AdminService.BlockingInterface admin = this.connection.getAdmin(server);<a name="line.3049"></a>
-<span class="sourceLineNo">3050</span>    Callable&lt;Void&gt; callable = new Callable&lt;Void&gt;() {<a name="line.3050"></a>
-<span class="sourceLineNo">3051</span>      @Override<a name="line.3051"></a>
-<span class="sourceLineNo">3052</span>      public Void call() throws Exception {<a name="line.3052"></a>
-<span class="sourceLineNo">3053</span>        admin.updateConfiguration(null, UpdateConfigurationRequest.getDefaultInstance());<a name="line.3053"></a>
-<span class="sourceLineNo">3054</span>        return null;<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>    ProtobufUtil.call(callable);<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 void updateConfiguration() throws IOException {<a name="line.3061"></a>
-<span class="sourceLineNo">3062</span>    for (ServerName server : this.getClusterStatus().getServers()) {<a name="line.3062"></a>
-<span class="sourceLineNo">3063</span>      updateConfiguration(server);<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>    updateConfiguration(this.getClusterStatus().getMaster());<a name="line.3066"></a>
-<span class="sourceLineNo">3067</span><a name="line.3067"></a>
-<span class="sourceLineNo">3068</span>    for (ServerName server : this.getClusterStatus().getBackupMasters()) {<a name="line.3068"></a>
-<span class="sourceLineNo">3069</span>      updateConfiguration(server);<a name="line.3069"></a>
-<span class="sourceLineNo">3070</span>    }<a name="line.3070"></a>
-<span class="sourceLineNo">3071</span>  }<a name="line.3071"></a>
-<span class="sourceLineNo">3072</span><a name="line.3072"></a>
-<span class="sourceLineNo">3073</span>  @Override<a name="line.3073"></a>
-<span class="sourceLineNo">3074</span>  public int getMasterInfoPort() throws IOException {<a name="line.3074"></a>
-<span class="sourceLineNo">3075</span>    // TODO: Fix!  Reaching into internal implementation!!!!<a name="line.3075"></a>
-<span class="sourceLineNo">3076</span>    ConnectionImplementation connection = (ConnectionImplementation)this.connection;<a name="line.3076"></a>
-<span class="sourceLineNo">3077</span>    ZooKeeperKeepAliveConnection zkw = connection.getKeepAliveZooKeeperWatcher();<a name="line.3077"></a>
-<span class="sourceLineNo">3078</span>    try {<a name="line.3078"></a>
-<span class="sourceLineNo">3079</span>      return MasterAddressTracker.getMasterInfoPort(zkw);<a name="line.3079"></a>
-<span class="sourceLineNo">3080</span>    } catch (KeeperException e) {<a name="line.3080"></a>
-<span class="sourceLineNo">3081</span>      throw new IOException("Failed to get master info port from MasterAddressTracker", e);<a name="line.3081"></a>
-<span class="sourceLineNo">3082</span>    }<a name="line.3082"></a>
-<span class="sourceLineNo">3083</span>  }<a name="line.3083"></a>
-<span class="sourceLineNo">3084</span><a name="line.3084"></a>
-<span class="sourceLineNo">3085</span>  private ServerName getMasterAddress() throws IOException {<a name="line.3085"></a>
-<span class="sourceLineNo">3086</span>    // TODO: Fix!  Reaching into internal implementation!!!!<a name="line.3086"></a>
-<span class="sourceLineNo">3087</span>    ConnectionImplementation connection = (ConnectionImplementation)this.connection;<a name="line.3087"></a>
-<span class="sourceLineNo">3088</span>    ZooKeeperKeepAliveConnection zkw = connection.getKeepAliveZooKeeperWatcher();<a name="line.3088"></a>
-<span class="sourceLineNo">3089</span>    try {<a name="line.3089"></a>
-<span class="sourceLineNo">3090</span>      return MasterAddressTracker.getMasterAddress(zkw);<a name="line.3090"></a>
-<span class="sourceLineNo">3091</span>    } catch (KeeperException e) {<a name="line.3091"></a>
-<span class="sourceLineNo">3092</span>      throw new IOException("Failed to get master server name from MasterAddressTracker", e);<a name="line.3092"></a>
-<span class="sourceLineNo">3093</span>    }<a name="line.3093"></a>
-<span class="sourceLineNo">3094</span>  }<a name="line.3094"></a>
-<span class="sourceLineNo">3095</span><a name="line.3095"></a>
-<span class="sourceLineNo">3096</span>  @Override<a name="line.3096"></a>
-<span class="sourceLineNo">3097</span>  public long getLastMajorCompactionTimestamp(final TableName tableName) throws IOException {<a name="line.3097"></a>
-<span class="sourceLineNo">3098</span>    return executeCallable(new MasterCallable&lt;Long&gt;(getConnection(), getRpcControllerFactory()) {<a name="line.3098"></a>
-<span class="sourceLineNo">3099</span>      @Override<a name="line.3099"></a>
-<span class="sourceLineNo">3100</span>      protected Long rpcCall() throws Exception {<a name="line.3100"></a>
-<span class="sourceLineNo">3101</span>        MajorCompactionTimestampRequest req =<a name="line.3101"></a>
-<span class="sourceLineNo">3102</span>            MajorCompactionTimestampRequest.newBuilder()<a name="line.3102"></a>
-<span class="sourceLineNo">3103</span>                .setTableName(ProtobufUtil.toProtoTableName(tableName)).build();<a name="line.3103"></a>
-<span class="sourceLineNo">3104</span>        return master.getLastMajorCompactionTimestamp(getRpcController(), req).<a name="line.3104"></a>
-<span class="sourceLineNo">3105</span>            getCompactionTimestamp();<a name="line.3105"></a>
-<span class="sourceLineNo">3106</span>      }<a name="line.3106"></a>
-<span class="sourceLineNo">3107</span>    });<a name="line.3107"></a>
-<span class="sourceLineNo">3108</span>  }<a name="line.3108"></a>
-<span class="sourceLineNo">3109</span><a name="line.3109"></a>
-<span class="sourceLineNo">3110</span>  @Override<a name="line.3110"></a>
-<span class="sourceLineNo">3111</span>  public long getLastMajorCompactionTimestampForRegion(final byte[] regionName) throws IOException {<a name="line.3111"></a>
-<span class="sourceLineNo">3112</span>    return executeCallable(new MasterCallable&lt;Long&gt;(getConnection(), getRpcControllerFactory()) {<a name="line.3112"></a>
-<span class="sourceLineNo">3113</span>      @Override<a name="line.3113"></a>
-<span class="sourceLineNo">3114</span>      protected Long rpcCall() throws Exception {<a name="line.3114"></a>
-<span class="sourceLineNo">3115</span>        MajorCompactionTimestampForRegionRequest req =<a name="line.3115"></a>
-<span class="sourceLineNo">3116</span>            MajorCompactionTimestampForRegionRequest.newBuilder().setRegion(RequestConverter<a name="line.3116"></a>
-<span class="sourceLineNo">3117</span>                      .buildRegionSpecifier(RegionSpecifierType.REGION_NAME, regionName)).build();<a name="line.3117"></a>
-<span class="sourceLineNo">3118</span>        return master.getLastMajorCompactionTimestampForRegion(getRpcController(), req)<a name="line.3118"></a>
-<span class="sourceLineNo">3119</span>            .getCompactionTimestamp();<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>  }<a name="line.3122"></a>
-<span class="sourceLineNo">3123</span><a name="line.3123"></a>
-<span class="sourceLineNo">3124</span>  /**<a name="line.3124"></a>
-<span class="sourceLineNo">3125</span>   * {@inheritDoc}<a name="line.3125"></a>
-<span class="sourceLineNo">3126</span>   */<a name="line.3126"></a>
-<span class="sourceLineNo">3127</span>  @Override<a name="line.3127"></a>
-<span class="sourceLineNo">3128</span>  public void compact(final TableName tableName, final byte[] columnFamily, CompactType compactType)<a name="line.3128"></a>
-<span class="sourceLineNo">3129</span>    throws IOException, InterruptedException {<a name="line.3129"></a>
-<span class="sourceLineNo">3130</span>    compact(tableName, columnFamily, false, compactType);<a name="line.3130"></a>
-<span class="sourceLineNo">3131</span>  }<a name="line.3131"></a>
-<span class="sourceLineNo">3132</span><a name="line.3132"></a>
-<span class="sourceLineNo">3133</span>  /**<a name="line.3133"></a>
-<span class="sourceLineNo">3134</span>   * {@inheritDoc}<a name="line.3134"></a>
-<span class="sourceLineNo">3135</span>   */<a name="line.3135"></a>
-<span class="sourceLineNo">3136</span>  @Override<a name="line.3136"></a>
-<span class="sourceLineNo">3137</span>  public void compact(final TableName tableName, CompactType compactType)<a name="line.3137"></a>
-<span class="sourceLineNo">3138</span>    throws IOException, InterruptedException {<a name="line.3138"></a>
-<span class="sourceLineNo">3139</span>    compact(tableName, null, false, compactType);<a name="line.3139"></a>
-<span class="sourceLineNo">3140</span>  }<a name="line.3140"></a>
-<span class="sourceLineNo">3141</span><a name="line.3141"></a>
-<span class="sourceLineNo">3142</span>  /**<a name="line.3142"></a>
-<span class="sourceLineNo">3143</span>   * {@inheritDoc}<a name="line.3143"></a>
-<span class="sourceLineNo">3144</span>   */<a name="line.3144"></a>
-<span class="sourceLineNo">3145</span>  @Override<a name="line.3145"></a>
-<span class="sourceLineNo">3146</span>  public void majorCompact(final TableName tableName, final byte[] columnFamily,<a name="line.3146"></a>
-<span class="sourceLineNo">3147</span>    CompactType compactType) throws IOException, InterruptedException {<a name="line.3147"></a>
-<span class="sourceLineNo">3148</span>    compact(tableName, columnFamily, true, compactType);<a name="line.3148"></a>
-<span class="sourceLineNo">3149</span>  }<a name="line.3149"></a>
-<span class="sourceLineNo">3150</span><a name="line.3150"></a>
-<span class="sourceLineNo">3151</span>  /**<a name="line.3151"></a>
-<span class="sourceLineNo">3152</span>   * {@inheritDoc}<a name="line.3152"></a>
-<span class="sourceLineNo">3153</span>   */<a name="line.3153"></a>
-<span class="sourceLineNo">3154</span>  @Override<a name="line.3154"></a>
-<span class="sourceLineNo">3155</span>  public void majorCompact(final TableName tableName, CompactType compactType)<a name="line.3155"></a>
-<span class="sourceLineNo">3156</span>          throws IOException, InterruptedException {<a name="line.3156"></a>
-<span class="sourceLineNo">3157</span>    compact(tableName, null, true, compactType);<a name="line.3157"></a>
-<span class="sourceLineNo">3158</span>  }<a name="line.3158"></a>
-<span class="sourceLineNo">3159</span><a name="line.3159"></a>
-<span class="sourceLineNo">3160</span>  /**<a name="line.3160"></a>
-<span class="sourceLineNo">3161</span>   * {@inheritDoc}<a name="line.3161"></a>
-<span class="sourceLineNo">3162</span>   */<a name="line.3162"></a>
-<span class="sourceLineNo">3163</span>  @Override<a name="line.3163"></a>
-<span class="sourceLineNo">3164</span>  public CompactionState getCompactionState(final TableName tableName,<a name="line.3164"></a>
-<span class="sourceLineNo">3165</span>    CompactType compactType) throws IOException {<a name="line.3165"></a>
-<span class="sourceLineNo">3166</span>    AdminProtos.GetRegionInfoResponse.CompactionState state =<a name="line.3166"></a>
-<span class="sourceLineNo">3167</span>        AdminProtos.GetRegionInfoResponse.CompactionState.NONE;<a name="line.3167"></a>
-<span class="sourceLineNo">3168</span>    checkTableExists(tableName);<a name="line.3168"></a>
-<span class="sourceLineNo">3169</span>    // TODO: There is no timeout on this controller. Set one!<a name="line.3169"></a>
-<span class="sourceLineNo">3170</span>    final HBaseRpcController rpcController = rpcControllerFactory.newController();<a name="line.3170"></a>
-<span class="sourceLineNo">3171</span>    switch (compactType) {<a name="line.3171"></a>
-<span class="sourceLineNo">3172</span>      case MOB:<a name="line.3172"></a>
-<span class="sourceLineNo">3173</span>        final AdminProtos.AdminService.BlockingInterface masterAdmin =<a name="line.3173"></a>
-<span class="sourceLineNo">3174</span>          this.connection.getAdmin(getMasterAddress());<a name="line.3174"></a>
-<span class="sourceLineNo">3175</span>        Callable&lt;AdminProtos.GetRegionInfoResponse.CompactionState&gt; callable =<a name="line.3175"></a>
-<span class="sourceLineNo">3176</span>            new Callable&lt;AdminProtos.GetRegionInfoResponse.CompactionState&gt;() {<a name="line.3176"></a>
-<span class="sourceLineNo">3177</span>          @Override<a name="line.3177"></a>
-<span class="sourceLineNo">3178</span>          public AdminProtos.GetRegionInfoResponse.CompactionState call() throws Exception {<a name="line.3178"></a>
-<span class="sourceLineNo">3179</span>            HRegionInfo info = getMobRegionInfo(tableName);<a name="line.3179"></a>
-<span class="sourceLineNo">3180</span>            GetRegionInfoRequest request = RequestConverter.buildGetRegionInfoRequest(<a name="line.3180"></a>
-<span class="sourceLineNo">3181</span>                info.getRegionName(), true);<a name="line.3181"></a>
-<span class="sourceLineNo">3182</span>            GetRegionInfoResponse response = masterAdmin.getRegionInfo(rpcController, request);<a name="line.3182"></a>
-<span class="sourceLineNo">3183</span>            return response.getCompactionState();<a name="line.3183"></a>
-<span class="sourceLineNo">3184</span>          }<a name="line.3184"></a>
-<span class="sourceLineNo">3185</span>        };<a name="line.3185"></a>
-<span class="sourceLineNo">3186</span>        state = ProtobufUtil.call(callable);<a name="line.3186"></a>
-<span class="sourceLineNo">3187</span>        break;<a name="line.3187"></a>
-<span class="sourceLineNo">3188</span>      case NORMAL:<a name="line.3188"></a>
-<span class="sourceLineNo">3189</span>      default:<a name="line.3189"></a>
-<span class="sourceLineNo">3190</span>        ZooKeeperWatcher zookeeper = null;<a name="line.3190"></a>
-<span class="sourceLineNo">3191</span>        try {<a name="line.3191"></a>
-<span class="sourceLineNo">3192</span>          List&lt;Pair&lt;HRegionInfo, ServerName&gt;&gt; pairs;<a name="line.3192"></a>
-<span class="sourceLineNo">3193</span>          if (TableName.META_TABLE_NAME.equals(tableName)) {<a name="line.3193"></a>
-<span class="sourceLineNo">3194</span>            zookeeper = new ZooKeeperWatcher(conf, ZK_IDENTIFIER_PREFIX + connection.toString(),<a name="line.3194"></a>
-<span class="sourceLineNo">3195</span>              new ThrowableAbortable());<a name="line.3195"></a>
-<span class="sourceLineNo">3196</span>            pairs = new MetaTableLocator().getMetaRegionsAndLocations(zookeeper);<a name="line.3196"></a>
-<span class="sourceLineNo">3197</span>          } else {<a name="line.3197"></a>
-<span class="sourceLineNo">3198</span>            pairs = MetaTableAccessor.getTableRegionsAndLocations(connection, tableName);<a name="line.3198"></a>
-<span class="sourceLineNo">3199</span>          }<a name="line.3199"></a>
-<span class="sourceLineNo">3200</span>          for (Pair&lt;HRegionInfo, ServerName&gt; pair: pairs) {<a name="line.3200"></a>
-<span class="sourceLineNo">3201</span>            if (pair.getFirst().isOffline()) continue;<a name="line.3201"></a>
-<span class="sourceLineNo">3202</span>            if (pair.getSecond() == null) continue;<a name="line.3202"></a>
-<span class="sourceLineNo">3203</span>            final ServerName sn = pair.getSecond();<a name="line.3203"></a>
-<span class="sourceLineNo">3204</span>            final byte [] regionName = pair.getFirst().getRegionName();<a name="line.3204"></a>
-<span class="sourceLineNo">3205</span>            final AdminService.BlockingInterface snAdmin = this.connection.getAdmin(sn);<a name="line.3205"></a>
-<span class="sourceLineNo">3206</span>            try {<a name="line.3206"></a>
-<span class="sourceLineNo">3207</span>              Callable&lt;GetRegionInfoResponse&gt; regionInfoCallable =<a name="line.3207"></a>
-<span class="sourceLineNo">3208</span>                  new Callable&lt;GetRegionInfoResponse&gt;() {<a name="line.3208"></a>
-<span class="sourceLineNo">3209</span>                @Override<a name="line.3209"></a>
-<span class="sourceLineNo">3210</span>                public GetRegionInfoResponse call() throws Exception {<a name="line.3210"></a>
-<span class="sourceLineNo">3211</span>                  GetRegionInfoRequest request = RequestConverter.buildGetRegionInfoRequest(<a name="line.3211"></a>
-<span class="sourceLineNo">3212</span>                      regionName, true);<a name="line.3212"></a>
-<span class="sourceLineNo">3213</span>                  return snAdmin.getRegionInfo(rpcController, request);<a name="line.3213"></a>
-<span class="sourceLineNo">3214</span>                }<a name="line.3214"></a>
-<span class="sourceLineNo">3215</span>              };<a name="line.3215"></a>
-<span class="sourceLineNo">3216</span>              GetRegionInfoResponse response = ProtobufUtil.call(regionInfoCallable);<a name="line.3216"></a>
-<span class="sourceLineNo">3217</span>              switch (response.getCompactionState()) {<a name="line.3217"></a>
-<span class="sourceLineNo">3218</span>                case MAJOR_AND_MINOR:<a name="line.3218"></a>
-<span class="sourceLineNo">3219</span>                  return CompactionState.MAJOR_AND_MINOR;<a name="line.3219"></a>
-<span class="sourceLineNo">3220</span>                case MAJOR:<a name="line.3220"></a>
-<span class="sourceLineNo">3221</span>                  if (state == AdminProtos.GetRegionInfoResponse.CompactionState.MINOR) {<a name="line.3221"></a>
-<span class="sourceLineNo">3222</span>                    return CompactionState.MAJOR_AND_MINOR;<a name="line.3222"></a>
-<span class="sourceLineNo">3223</span>                  }<a name="line.3223"></a>
-<span class="sourceLineNo">3224</span>                  state = AdminProtos.GetRegionInfoResponse.CompactionState.MAJOR;<a name="line.3224"></a>
-<span class="sourceLineNo">3225</span>                  break;<a name="line.3225"></a>
-<span class="sourceLineNo">3226</span>                case MINOR:<a name="line.3226"></a>
-<span class="sourceLineNo">3227</span>                  if (state == AdminProtos.GetRegionInfoResponse.CompactionState.MAJOR) {<a name="line.3227"></a>
-<span class="sourceLineNo">3228</span>                    return CompactionState.MAJOR_AND_MINOR;<a name="line.3228"></a>
-<span class="sourceLineNo">3229</span>                  }<a name="line.3229"></a>
-<span class="sourceLineNo">3230</span>                  state = AdminProtos.GetRegionInfoResponse.CompactionState.MINOR;<a name="line.3230"></a>
-<span class="sourceLineNo">3231</span>                  break;<a name="line.3231"></a>
-<span class="sourceLineNo">3232</span>                case NONE:<a name="line.3232"></a>
-<span class="sourceLineNo">3233</span>                default: // nothing, continue<a name="line.3233"></a>
-<span class="sourceLineNo">3234</span>              }<a name="line.3234"></a>
-<span class="sourceLineNo">3235</span>            } catch (NotServingRegionException e) {<a name="line.3235"></a>
-<span class="sourceLineNo">3236</span>              if (LOG.isDebugEnabled()) {<a name="line.3236"></a>
-<span class="sourceLineNo">3237</span>                LOG.debug("Trying to get compaction state of " +<a name="line.3237"></a>
-<span class="sourceLineNo">3238</span>                        pair.getFirst() + ": " +<a name="line.3238"></a>
-<span class="sourceLineNo">3239</span>                        StringUtils.stringifyException(e));<a name="line.3239"></a>
-<span class="sourceLineNo">3240</span>              }<a name="line.3240"></a>
-<span class="sourceLineNo">3241</span>            } catch (RemoteException e) {<a name="line.3241"></a>
-<span class="sourceLineNo">3242</span>              if (e.getMessage().indexOf(NotServingRegionException.class.getName()) &gt;= 0) {<a name="line.3242"></a>
-<span class="sourceLineNo">3243</span>                if (LOG.isDebugEnabled()) {<a name="line.3243"></a>
-<span class="sourceLineNo">3244</span>                  LOG.debug("Trying to get compaction state of " + pair.getFirst() + ": "<a name="line.3244"></a>
-<span class="sourceLineNo">3245</span>                          + StringUtils.stringifyException(e));<a name="line.3245"></a>
-<span class="sourceLineNo">3246</span>                }<a name="line.3246"></a>
-<span class="sourceLineNo">3247</span>              } else {<a name="line.3247"></a>
-<span class="sourceLineNo">3248</span>                throw e;<a name="line.3248"></a>
-<span class="sourceLineNo">3249</span>              }<a name="line.3249"></a>
-<span class="sourceLineNo">3250</span>            }<a name="line.3250"></a>
-<span class="sourceLineNo">3251</span>          }<a name="line.3251"></a>
-<span class="sourceLineNo">3252</span>        } finally {<a name="line.3252"></a>
-<span class="sourceLineNo">3253</span>          if (zookeeper != null) {<a name="line.3253"></a>
-<span class="sourceLineNo">3254</span>            zookeeper.close();<a name="line.3254"></a>
-<span class="sourceLineNo">3255</span>          }<a name="line.3255"></a>
-<span class="sourceLineNo">3256</span>        }<a name="line.3256"></a>
-<span class="sourceLineNo">3257</span>        break;<a name="line.3257"></a>
-<span class="sourceLineNo">3258</span>    }<a name="line.3258"></a>
-<span class="sourceLineNo">3259</span>    if(state != null) {<a name="line.3259"></a>
-<span class="sourceLineNo">3260</span>      return ProtobufUtil.createCompactionState(state);<a name="line.3260"></a>
-<span class="sourceLineNo">3261</span>    }<a name="line.3261"></a>
-<span class="sourceLineNo">3262</span>    return null;<a name="line.3262"></a>
-<span class="sourceLineNo">3263</span>  }<a name="line.3263"></a>
-<span class="sourceLineNo">3264</span><a name="line.3264"></a>
-<span class="sourceLineNo">3265</span>  /**<a name="line.3265"></a>
-<span class="sourceLineNo">3266</span>   * Future that waits on a procedure result.<a name="line.3266"></a>
-<span class="sourceLineNo">3267</span>   * Returned by the async version of the Admin calls,<a name="line.3267"></a>
-<span class="sourceLineNo">3268</span>   * and used internally by the sync calls to wait on the result of the procedure.<a name="line.3268"></a>
-<span class="sourceLineNo">3269</span>   */<a name="line.3269"></a>
-<span class="sourceLineNo">3270</span>  @InterfaceAudience.Private<a name="line.3270"></a>
-<span class="sourceLineNo">3271</span>  @InterfaceStability.Evolving<a name="line.3271"></a>
-<span class="sourceLineNo">3272</span>  protected static class ProcedureFuture&lt;V&gt; implements Future&lt;V&gt; {<a name="line.3272"></a>
-<span class="sourceLineNo">3273</span>    private ExecutionException exception = null;<a name="line.3273"></a>
-<span class="sourceLineNo">3274</span>    private boolean procResultFound = false;<a name="line.3274"></a>
-<span class="sourceLineNo">3275</span>    private boolean done = false;<a name="line.3275"></a>
-<span class="sourceLineNo">3276</span>    private boolean cancelled = false;<a name="line.3276"></a>
-<span class="sourceLineNo">3277</span>    private V result = null;<a name="line.3277"></a>
-<span class="sourceLineNo">3278</span><a name="line.3278"></a>
-<span class="sourceLineNo">3279</span>    private final HBaseAdmin admin;<a name="line.3279"></a>
-<span class="sourceLineNo">3280</span>    private final Long procId;<a name="line.3280"></a>
-<span class="sourceLineNo">3281</span><a name="line.3281"></a>
-<span class="sourceLineNo">3282</span>    public ProcedureFuture(final HBaseAdmin admin, final Long procId) {<a name="line.3282"></a>
-<span class="sourceLineNo">3283</span>      this.admin = admin;<a name="line.3283"></a>
-<span class="sourceLineNo">3284</span>      this.procId = procId;<a name="line.3284"></a>
-<span class="sourceLineNo">3285</span>    }<a name="line.3285"></a>
-<span class="sourceLineNo">3286</span><a name="line.3286"></a>
-<span class="sourceLineNo">3287</span>    @Override<a name="line.3287"></a>
-<span class="sourceLineNo">3288</span>    public boolean cancel(boolean mayInterruptIfRunning) {<a name="line.3288"></a>
-<span class="sourceLineNo">3289</span>      AbortProcedureRequest abortProcRequest = AbortProcedureRequest.newBuilder()<a name="line.3289"></a>
-<span class="sourceLineNo">3290</span>          .setProcId(procId).setMayInterruptIfRunning(mayInterruptIfRunning).build();<a name="line.3290"></a>
-<span class="sourceLineNo">3291</span>      try {<a name="line.3291"></a>
-<span class="sourceLineNo">3292</span>        cancelled = abortProcedureResult(abortProcRequest).getIsProcedureAborted();<a name="line.3292"></a>
-<span class="sourceLineNo">3293</span>        if (cancelled) {<a name="line.3293"></a>
-<span class="sourceLineNo">3294</span>          done = true;<a name="line.3294"></a>
-<span class="sourceLineNo">3295</span>        }<a name="line.3295"></a>
-<span class="sourceLineNo">3296</span>      } catch (IOException e) {<a name="line.3296"></a>
-<span class="sourceLineNo">3297</span>        // Cancell thrown exception for some reason. At this time, we are not sure whether<a name="line.3297"></a>
-<span class="sourceLineNo">3298</span>        // the cancell succeeds or fails. We assume that it is failed, but print out a warning<a name="line.3298"></a>
-<span class="sourceLineNo">3299</span>        // for debugging purpose.<a name="line.3299"></a>
-<span class="sourceLineNo">3300</span>        LOG.warn(<a name="line.3300"></a>
-<span class="sourceLineNo">3301</span>          "Cancelling the procedure with procId=" + procId + " throws exception " + e.getMessage(),<a name="line.3301"></a>
-<span class="sourceLineNo">3302</span>          e);<a name="line.3302"></a>
-<span class="sourceLineNo">3303</span>        cancelled = false;<a name="line.3303"></a>
-<span class="sourceLineNo">3304</span>      }<a name="line.3304"></a>
-<span class="sourceLineNo">3305</span>      return cancelled;<a name="line.3305"></a>
-<span class="sourceLineNo">3306</span>    }<a name="line.3306"></a>
-<span class="sourceLineNo">3307</span><a name="line.3307"></a>
-<span class="sourceLineNo">3308</span>    @Override<a name="line.3308"></a>
-<span class="sourceLineNo">3309</span>    public boolean isCancelled() {<a name="line.3309"></a>
-<span class="sourceLineNo">3310</span>      return cancelled;<a name="line.3310"></a>
-<span class="sourceLineNo">3311</span>    }<a name="line.3311"></a>
-<span class="sourceLineNo">3312</span><a name="line.3312"></a>
-<span class="sourceLineNo">3313</span>    protected AbortProcedureResponse abortProcedureResult(<a name="line.3313"></a>
-<span class="sourceLineNo">3314</span>        final AbortProcedureRequest request) throws IOException {<a name="line.3314"></a>
-<span class="sourceLineNo">3315</span>      return admin.executeCallable(new MasterCallable&lt;AbortProcedureResponse&gt;(<a name="line.3315"></a>
-<span class="sourceLineNo">3316</span>          admin.getConnection(), admin.getRpcControllerFactory()) {<a name="line.3316"></a>
-<span class="sourceLineNo">3317</span>        @Override<a name="line.3317"></a>
-<span class="sourceLineNo">3318</span>        protected AbortProcedureResponse rpcCall() throws Exception {<a name="line.3318"></a>
-<span class="sourceLineNo">3319</span>          return master.abortProcedure(getRpcController(), request);<a name="line.3319"></a>
-<span class="sourceLineNo">3320</span>        }<a name="line.3320"></a>
-<span class="sourceLineNo">3321</span>      });<a name="line.3321"></a>
-<span class="sourceLineNo">3322</span>    }<a name="line.3322"></a>
-<span class="sourceLineNo">3323</span><a name="line.3323"></a>
-<span class="sourceLineNo">3324</span>    @Override<a name="line.3324"></a>
-<span class="sourceLineNo">3325</span>    public V get() throws InterruptedException, ExecutionException {<a name="line.3325"></a>
-<span class="sourceLineNo">3326</span>      // TODO: should we ever spin forever?<a name="line.3326"></a>
-<span class="sourceLineNo">3327</span>      throw new UnsupportedOperationException();<a name="line.3327"></a>
-<span class="sourceLineNo">3328</span>    }<a name="line.3328"></a>
-<span class="sourceLineNo">3329</span><a name="line.3329"></a>
-<span class="sourceLineNo">3330</span>    @Override<a name="line.3330"></a>
-<span class="sourceLineNo">3331</span>    public V get(long timeout, TimeUnit unit)<a name="line.3331"></a>
-<span class="sourceLineNo">3332</span>        throws InterruptedException, ExecutionException, TimeoutException {<a name="line.3332"></a>
-<span class="sourceLineNo">3333</span>      if (!done) {<a name="line.3333"></a>
-<span class="sourceLineNo">3334</span>        long deadlineTs = EnvironmentEdgeManager.currentTime() + unit.toMillis(timeout);<a name="line.3334"></a>
-<span class="sourceLineNo">3335</span>        try {<a name="line.3335"></a>
-<span class="sourceLineNo">3336</span>          try {<a name="line.3336"></a>
-<span class="sourceLineNo">3337</span>            // if the master support procedures, try to wait the result<a name="line.3337"></a>
-<span class="sourceLineNo">3338</span>            if (procId != null) {<a name="line.3338"></a>
-<span class="sourceLineNo">3339</span>              result = waitProcedureResult(procId, deadlineTs);<a name="line.3339"></a>
-<span class="sourceLineNo">3340</span>            }<a name="line.3340"></a>
-<span class="sourceLineNo">3341</span>            // if we don't have a proc result, try the compatibility wait<a name="line.3341"></a>
-<span class="sourceLineNo">3342</span>            if (!procResultFound) {<a name="line.3342"></a>
-<span class="sourceLineNo">3343</span>              result = waitOperationResult(deadlineTs);<a name="line.3343"></a>
-<span class="sourceLineNo">3344</span>            }<a name="line.3344"></a>
-<span class="sourceLineNo">3345</span>            result = postOperationResult(result, deadlineTs);<a name="line.3345"></a>
-<span class="sourceLineNo">3346</span>            done = true;<a name="line.3346"></a>
-<span class="sourceLineNo">3347</span>          } catch (IOException e) {<a name="line.3347"></a>
-<span class="sourceLineNo">3348</span>            result = postOperationFailure(e, deadlineTs);<a name="line.3348"></a>
-<span class="sourceLineNo">3349</span>            done = true;<a name="line.3349"></a>
-<span class="sourceLineNo">3350</span>          }<a name="line.3350"></a>
-<span class="sourceLineNo">3351</span>        } catch (IOException e) {<a name="line.3351"></a>
-<span class="sourceLineNo">3352</span>          exception = new ExecutionException(e);<a name="line.3352"></a>
-<span class="sourceLineNo">3353</span>          done = true;<a name="line.3353"></a>
-<span class="sourceLineNo">3354</span>        }<a name="line.3354"></a>
-<span class="sourceLineNo">3355</span>      }<a name="line.3355"></a>
-<span class="sourceLineNo">3356</span>      if (exception != null) {<a name="line.3356"></a>
-<span class="sourceLineNo">3357</span>        throw exception;<a name="line.3357"></a>
-<span class="sourceLineNo">3358</span>      }<a name="line.3358"></a>
-<span class="sourceLineNo">3359</span>      return result;<a name="line.3359"></a>
-<span class="sourceLineNo">3360</span>    }<a name="line.3360"></a>
-<span class="sourceLineNo">3361</span><a name="line.3361"></a>
-<span class="sourceLineNo">3362</span>    @Override<a name="line.3362"></a>
-<span class="sourceLineNo">3363</span>    public boolean isDone() {<a name="line.3363"></a>
-<span class="sourceLineNo">3364</span>      return done;<a name="line.3364"></a>
-<span class="sourceLineNo">3365</span>    }<a name="line.3365"></a>
-<span class="sourceLineNo">3366</span><a name="line.3366"></a>
-<span class="sourceLineNo">3367</span>    protected HBaseAdmin getAdmi

<TRUNCATED>

Mime
View raw message