hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject hbase git commit: HBASE-19029 Align RPC timout methods in Table and AsyncTableBase
Date Wed, 25 Oct 2017 16:55:28 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-2 aed0d6ce2 -> 5dadfdaa5


HBASE-19029 Align RPC timout methods in Table and AsyncTableBase

As part of HBASE-18978 the rpc timeout methods gets aligned
between Table and AsyncTable interfaces.
Deprecate the following methods in Table:
- int getRpcTimeout()
- int getReadRpcTimeout()
- int getWriteRpcTimeout()
- int getOperationTimeout()

Add the following methods to Table:
- long getRpcTimeout(TimeUnit)
- long getReadRpcTimeout(TimeUnit)
- long getWriteRpcTimeout(TimeUnit)
- long getOperationTimeout(TimeUnit)

Fix some javadoc issues.

Signed-off-by: Michael Stack <stack@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/5dadfdaa
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/5dadfdaa
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/5dadfdaa

Branch: refs/heads/branch-2
Commit: 5dadfdaa58d677347c904ef6e3767053aa71d72c
Parents: aed0d6c
Author: Peter Somogyi <psomogyi@cloudera.com>
Authored: Tue Oct 17 16:13:53 2017 -0700
Committer: Michael Stack <stack@apache.org>
Committed: Wed Oct 25 09:55:16 2017 -0700

----------------------------------------------------------------------
 .../hadoop/hbase/client/AsyncTableBase.java     |  10 ++
 .../org/apache/hadoop/hbase/client/HTable.java  | 151 +++++++++++--------
 .../org/apache/hadoop/hbase/client/Table.java   |  80 +++++++---
 .../hadoop/hbase/rest/client/RemoteHTable.java  |  24 +++
 .../hbase/regionserver/RegionAsTable.java       |  25 ++-
 5 files changed, 208 insertions(+), 82 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/5dadfdaa/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncTableBase.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncTableBase.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncTableBase.java
index cc9f337..7d24c4f 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncTableBase.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncTableBase.java
@@ -63,27 +63,37 @@ public interface AsyncTableBase {
    * specific rpc timeout config such as readRpcTimeout or writeRpcTimeout.
    * @see #getReadRpcTimeout(TimeUnit)
    * @see #getWriteRpcTimeout(TimeUnit)
+   * @param unit the unit of time the timeout to be represented in
+   * @return rpc timeout in the specified time unit
    */
   long getRpcTimeout(TimeUnit unit);
 
   /**
    * Get timeout of each rpc read request in this Table instance.
+   * @param unit the unit of time the timeout to be represented in
+   * @return read rpc timeout in the specified time unit
    */
   long getReadRpcTimeout(TimeUnit unit);
 
   /**
    * Get timeout of each rpc write request in this Table instance.
+   * @param unit the unit of time the timeout to be represented in
+   * @return write rpc timeout in the specified time unit
    */
   long getWriteRpcTimeout(TimeUnit unit);
 
   /**
    * Get timeout of each operation in Table instance.
+   * @param unit the unit of time the timeout to be represented in
+   * @return operation rpc timeout in the specified time unit
    */
   long getOperationTimeout(TimeUnit unit);
 
   /**
    * Get the timeout of a single operation in a scan. It works like operation timeout for
other
    * operations.
+   * @param unit the unit of time the timeout to be represented in
+   * @return scan rpc timeout in the specified time unit
    */
   long getScanTimeout(TimeUnit unit);
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/5dadfdaa/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java
index 0276957..7da1662 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java
@@ -112,10 +112,10 @@ public class HTable implements Table {
   private final int scannerCaching;
   private final long scannerMaxResultSize;
   private final ExecutorService pool;  // For Multi & Scan
-  private int operationTimeout; // global timeout for each blocking method with retrying
rpc
-  private final int rpcTimeout; // FIXME we should use this for rpc like batch and checkAndXXX
-  private int readRpcTimeout; // timeout for each read rpc request
-  private int writeRpcTimeout; // timeout for each write rpc request
+  private int operationTimeoutMs; // global timeout for each blocking method with retrying
rpc
+  private final int rpcTimeoutMs; // FIXME we should use this for rpc like batch and checkAndXXX
+  private int readRpcTimeoutMs; // timeout for each read rpc request
+  private int writeRpcTimeoutMs; // timeout for each write rpc request
   private final boolean cleanupPoolOnClose; // shutdown the pool in close()
   private final HRegionLocator locator;
 
@@ -187,10 +187,10 @@ public class HTable implements Table {
     }
 
     this.tableName = builder.tableName;
-    this.operationTimeout = builder.operationTimeout;
-    this.rpcTimeout = builder.rpcTimeout;
-    this.readRpcTimeout = builder.readRpcTimeout;
-    this.writeRpcTimeout = builder.writeRpcTimeout;
+    this.operationTimeoutMs = builder.operationTimeout;
+    this.rpcTimeoutMs = builder.rpcTimeout;
+    this.readRpcTimeoutMs = builder.readRpcTimeout;
+    this.writeRpcTimeoutMs = builder.writeRpcTimeout;
     this.scannerCaching = connConfiguration.getScannerCaching();
     this.scannerMaxResultSize = connConfiguration.getScannerMaxResultSize();
 
@@ -235,7 +235,7 @@ public class HTable implements Table {
   @Override
   public HTableDescriptor getTableDescriptor() throws IOException {
     HTableDescriptor htd = HBaseAdmin.getHTableDescriptor(tableName, connection, rpcCallerFactory,
-      rpcControllerFactory, operationTimeout, readRpcTimeout);
+      rpcControllerFactory, operationTimeoutMs, readRpcTimeoutMs);
     if (htd != null) {
       return new ImmutableHTableDescriptor(htd);
     }
@@ -245,7 +245,7 @@ public class HTable implements Table {
   @Override
   public TableDescriptor getDescriptor() throws IOException {
     return HBaseAdmin.getTableDescriptor(tableName, connection, rpcCallerFactory,
-      rpcControllerFactory, operationTimeout, readRpcTimeout);
+      rpcControllerFactory, operationTimeoutMs, readRpcTimeoutMs);
   }
 
   /**
@@ -392,17 +392,16 @@ public class HTable implements Table {
             ProtobufUtil.toResult(response.getResult(), getRpcControllerCellScanner());
         }
       };
-      return rpcCallerFactory.<Result>newCaller(readRpcTimeout).callWithRetries(callable,
-          this.operationTimeout);
+      return rpcCallerFactory.<Result>newCaller(readRpcTimeoutMs).callWithRetries(callable,
+          this.operationTimeoutMs);
     }
 
     // Call that takes into account the replica
     RpcRetryingCallerWithReadReplicas callable = new RpcRetryingCallerWithReadReplicas(
         rpcControllerFactory, tableName, this.connection, get, pool,
-        connConfiguration.getRetriesNumber(),
-        operationTimeout, readRpcTimeout,
+        connConfiguration.getRetriesNumber(), operationTimeoutMs, readRpcTimeoutMs,
         connConfiguration.getPrimaryCallTimeoutMicroSecond());
-    return callable.call(operationTimeout);
+    return callable.call(operationTimeoutMs);
   }
 
   /**
@@ -415,7 +414,7 @@ public class HTable implements Table {
     }
     try {
       Object[] r1 = new Object[gets.size()];
-      batch((List<? extends Row>)gets, r1, readRpcTimeout);
+      batch((List<? extends Row>)gets, r1, readRpcTimeoutMs);
       // Translate.
       Result [] results = new Result[r1.length];
       int i = 0;
@@ -435,7 +434,7 @@ public class HTable implements Table {
   @Override
   public void batch(final List<? extends Row> actions, final Object[] results)
       throws InterruptedException, IOException {
-    int rpcTimeout = writeRpcTimeout;
+    int rpcTimeout = writeRpcTimeoutMs;
     boolean hasRead = false;
     boolean hasWrite = false;
     for (Row action : actions) {
@@ -449,7 +448,7 @@ public class HTable implements Table {
       }
     }
     if (hasRead && !hasWrite) {
-      rpcTimeout = readRpcTimeout;
+      rpcTimeout = readRpcTimeoutMs;
     }
     batch(actions, results, rpcTimeout);
   }
@@ -462,7 +461,7 @@ public class HTable implements Table {
             .setRowAccess(actions)
             .setResults(results)
             .setRpcTimeout(rpcTimeout)
-            .setOperationTimeout(operationTimeout)
+            .setOperationTimeout(operationTimeoutMs)
             .setSubmittedRows(AsyncProcessTask.SubmittedRows.ALL)
             .build();
     AsyncRequestFuture ars = multiAp.submit(task);
@@ -514,7 +513,7 @@ public class HTable implements Table {
     CancellableRegionServerCallable<SingleResponse> callable =
         new CancellableRegionServerCallable<SingleResponse>(
             connection, getName(), delete.getRow(), this.rpcControllerFactory.newController(),
-            writeRpcTimeout, new RetryingTimeTracker().start(), delete.getPriority()) {
+            writeRpcTimeoutMs, new RetryingTimeTracker().start(), delete.getPriority()) {
       @Override
       protected SingleResponse rpcCall() throws Exception {
         MutateRequest request = RequestConverter.buildMutateRequest(
@@ -529,8 +528,8 @@ public class HTable implements Table {
             .setTableName(tableName)
             .setRowAccess(rows)
             .setCallable(callable)
-            .setRpcTimeout(writeRpcTimeout)
-            .setOperationTimeout(operationTimeout)
+            .setRpcTimeout(writeRpcTimeoutMs)
+            .setOperationTimeout(operationTimeoutMs)
             .setSubmittedRows(AsyncProcessTask.SubmittedRows.ALL)
             .build();
     AsyncRequestFuture ars = multiAp.submit(task);
@@ -548,7 +547,7 @@ public class HTable implements Table {
   throws IOException {
     Object[] results = new Object[deletes.size()];
     try {
-      batch(deletes, results, writeRpcTimeout);
+      batch(deletes, results, writeRpcTimeoutMs);
     } catch (InterruptedException e) {
       throw (InterruptedIOException)new InterruptedIOException().initCause(e);
     } finally {
@@ -584,8 +583,8 @@ public class HTable implements Table {
             return null;
           }
         };
-    rpcCallerFactory.<Void> newCaller(this.writeRpcTimeout).callWithRetries(callable,
-      this.operationTimeout);
+    rpcCallerFactory.<Void> newCaller(this.writeRpcTimeoutMs).callWithRetries(callable,
+      this.operationTimeoutMs);
   }
 
   /**
@@ -599,7 +598,7 @@ public class HTable implements Table {
     }
     Object[] results = new Object[puts.size()];
     try {
-      batch(puts, results, writeRpcTimeout);
+      batch(puts, results, writeRpcTimeoutMs);
     } catch (InterruptedException e) {
       throw (InterruptedIOException) new InterruptedIOException().initCause(e);
     }
@@ -612,7 +611,8 @@ public class HTable implements Table {
   public void mutateRow(final RowMutations rm) throws IOException {
     CancellableRegionServerCallable<MultiResponse> callable =
       new CancellableRegionServerCallable<MultiResponse>(this.connection, getName(),
rm.getRow(),
-          rpcControllerFactory.newController(), writeRpcTimeout, new RetryingTimeTracker().start(),
rm.getMaxPriority()){
+          rpcControllerFactory.newController(), writeRpcTimeoutMs,
+          new RetryingTimeTracker().start(), rm.getMaxPriority()) {
       @Override
       protected MultiResponse rpcCall() throws Exception {
         RegionAction.Builder regionMutationBuilder = RequestConverter.buildRegionAction(
@@ -637,8 +637,8 @@ public class HTable implements Table {
             .setTableName(tableName)
             .setRowAccess(rm.getMutations())
             .setCallable(callable)
-            .setRpcTimeout(writeRpcTimeout)
-            .setOperationTimeout(operationTimeout)
+            .setRpcTimeout(writeRpcTimeoutMs)
+            .setOperationTimeout(operationTimeoutMs)
             .setSubmittedRows(AsyncProcessTask.SubmittedRows.ALL)
             .build();
     AsyncRequestFuture ars = multiAp.submit(task);
@@ -666,8 +666,8 @@ public class HTable implements Table {
         return ProtobufUtil.toResult(response.getResult(), getRpcControllerCellScanner());
       }
     };
-    return rpcCallerFactory.<Result> newCaller(this.writeRpcTimeout).
-        callWithRetries(callable, this.operationTimeout);
+    return rpcCallerFactory.<Result> newCaller(this.writeRpcTimeoutMs).
+        callWithRetries(callable, this.operationTimeoutMs);
   }
 
   /**
@@ -688,8 +688,8 @@ public class HTable implements Table {
         return ProtobufUtil.toResult(response.getResult(), getRpcControllerCellScanner());
       }
     };
-    return rpcCallerFactory.<Result> newCaller(writeRpcTimeout).callWithRetries(callable,
-        this.operationTimeout);
+    return rpcCallerFactory.<Result> newCaller(writeRpcTimeoutMs).callWithRetries(callable,
+        this.operationTimeoutMs);
   }
 
   /**
@@ -733,8 +733,8 @@ public class HTable implements Table {
         return Long.valueOf(Bytes.toLong(result.getValue(family, qualifier)));
       }
     };
-    return rpcCallerFactory.<Long> newCaller(this.writeRpcTimeout).
-        callWithRetries(callable, this.operationTimeout);
+    return rpcCallerFactory.<Long> newCaller(this.writeRpcTimeoutMs).
+        callWithRetries(callable, this.operationTimeoutMs);
   }
 
   /**
@@ -765,8 +765,8 @@ public class HTable implements Table {
         return Boolean.valueOf(response.getProcessed());
       }
     };
-    return rpcCallerFactory.<Boolean> newCaller(this.writeRpcTimeout).
-    callWithRetries(callable, this.operationTimeout);
+    return rpcCallerFactory.<Boolean> newCaller(this.writeRpcTimeoutMs).
+    callWithRetries(callable, this.operationTimeoutMs);
   }
 
   /**
@@ -808,8 +808,8 @@ public class HTable implements Table {
   throws IOException {
     CancellableRegionServerCallable<SingleResponse> callable =
     new CancellableRegionServerCallable<SingleResponse>(
-    this.connection, getName(), row, this.rpcControllerFactory.newController(),
-    writeRpcTimeout, new RetryingTimeTracker().start(), delete.getPriority()) {
+    this.connection, getName(), row, this.rpcControllerFactory.newController(), writeRpcTimeoutMs,
+        new RetryingTimeTracker().start(), delete.getPriority()) {
       @Override
       protected SingleResponse rpcCall() throws Exception {
         CompareType compareType = CompareType.valueOf(opName);
@@ -828,8 +828,8 @@ public class HTable implements Table {
     .setRowAccess(rows)
     .setCallable(callable)
     // TODO any better timeout?
-    .setRpcTimeout(Math.max(readRpcTimeout, writeRpcTimeout))
-    .setOperationTimeout(operationTimeout)
+    .setRpcTimeout(Math.max(readRpcTimeoutMs, writeRpcTimeoutMs))
+    .setOperationTimeout(operationTimeoutMs)
     .setSubmittedRows(AsyncProcessTask.SubmittedRows.ALL)
     .setResults(results)
     .build();
@@ -868,7 +868,8 @@ public class HTable implements Table {
   throws IOException {
     CancellableRegionServerCallable<MultiResponse> callable =
     new CancellableRegionServerCallable<MultiResponse>(connection, getName(), rm.getRow(),
-    rpcControllerFactory.newController(), writeRpcTimeout, new RetryingTimeTracker().start(),
rm.getMaxPriority()) {
+    rpcControllerFactory.newController(), writeRpcTimeoutMs, new RetryingTimeTracker().start(),
+        rm.getMaxPriority()) {
       @Override
       protected MultiResponse rpcCall() throws Exception {
         CompareType compareType = CompareType.valueOf(opName);
@@ -901,8 +902,8 @@ public class HTable implements Table {
     .setResults(results)
     .setCallable(callable)
     // TODO any better timeout?
-    .setRpcTimeout(Math.max(readRpcTimeout, writeRpcTimeout))
-    .setOperationTimeout(operationTimeout)
+    .setRpcTimeout(Math.max(readRpcTimeoutMs, writeRpcTimeoutMs))
+    .setOperationTimeout(operationTimeoutMs)
     .setSubmittedRows(AsyncProcessTask.SubmittedRows.ALL)
     .build();
     AsyncRequestFuture ars = multiAp.submit(task);
@@ -961,7 +962,7 @@ public class HTable implements Table {
 
     Object[] r1= new Object[exists.size()];
     try {
-      batch(exists, r1, readRpcTimeout);
+      batch(exists, r1, readRpcTimeoutMs);
     } catch (InterruptedException e) {
       throw (InterruptedIOException)new InterruptedIOException().initCause(e);
     }
@@ -1134,20 +1135,14 @@ public class HTable implements Table {
   }
 
   @Override
-  @Deprecated
-  public void setOperationTimeout(int operationTimeout) {
-    this.operationTimeout = operationTimeout;
-  }
-
-  @Override
-  public int getOperationTimeout() {
-    return operationTimeout;
+  public long getRpcTimeout(TimeUnit unit) {
+    return unit.convert(rpcTimeoutMs, TimeUnit.MILLISECONDS);
   }
 
   @Override
   @Deprecated
   public int getRpcTimeout() {
-    return rpcTimeout;
+    return rpcTimeoutMs;
   }
 
   @Override
@@ -1158,23 +1153,54 @@ public class HTable implements Table {
   }
 
   @Override
+  public long getReadRpcTimeout(TimeUnit unit) {
+    return unit.convert(readRpcTimeoutMs, TimeUnit.MILLISECONDS);
+  }
+
+  @Override
+  @Deprecated
+  public int getReadRpcTimeout() {
+    return readRpcTimeoutMs;
+  }
+
+  @Override
+  @Deprecated
+  public void setReadRpcTimeout(int readRpcTimeout) {
+    this.readRpcTimeoutMs = readRpcTimeout;
+  }
+
+  @Override
+  public long getWriteRpcTimeout(TimeUnit unit) {
+    return unit.convert(writeRpcTimeoutMs, TimeUnit.MILLISECONDS);
+  }
+
+  @Override
+  @Deprecated
   public int getWriteRpcTimeout() {
-    return writeRpcTimeout;
+    return writeRpcTimeoutMs;
   }
 
   @Override
   @Deprecated
   public void setWriteRpcTimeout(int writeRpcTimeout) {
-    this.writeRpcTimeout = writeRpcTimeout;
+    this.writeRpcTimeoutMs = writeRpcTimeout;
   }
 
   @Override
-  public int getReadRpcTimeout() { return readRpcTimeout; }
+  public long getOperationTimeout(TimeUnit unit) {
+    return unit.convert(operationTimeoutMs, TimeUnit.MILLISECONDS);
+  }
 
   @Override
   @Deprecated
-  public void setReadRpcTimeout(int readRpcTimeout) {
-    this.readRpcTimeout = readRpcTimeout;
+  public int getOperationTimeout() {
+    return operationTimeoutMs;
+  }
+
+  @Override
+  @Deprecated
+  public void setOperationTimeout(int operationTimeout) {
+    this.operationTimeoutMs = operationTimeout;
   }
 
   @Override
@@ -1272,13 +1298,14 @@ public class HTable implements Table {
         callbackErrorServers.add("null");
       }
     };
-    AsyncProcessTask<ClientProtos.CoprocessorServiceResult> task = AsyncProcessTask.newBuilder(resultsCallback)
+    AsyncProcessTask<ClientProtos.CoprocessorServiceResult> task =
+        AsyncProcessTask.newBuilder(resultsCallback)
             .setPool(pool)
             .setTableName(tableName)
             .setRowAccess(execs)
             .setResults(results)
-            .setRpcTimeout(readRpcTimeout)
-            .setOperationTimeout(operationTimeout)
+            .setRpcTimeout(readRpcTimeoutMs)
+            .setOperationTimeout(operationTimeoutMs)
             .setSubmittedRows(AsyncProcessTask.SubmittedRows.ALL)
             .build();
     AsyncRequestFuture future = asyncProcess.submit(task);

http://git-wip-us.apache.org/repos/asf/hbase/blob/5dadfdaa/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Table.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Table.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Table.java
index 2d434d6..f3dae4e 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Table.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Table.java
@@ -22,6 +22,7 @@ import java.io.Closeable;
 import java.io.IOException;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.CompareOperator;
@@ -660,29 +661,21 @@ public interface Table extends Closeable {
                          byte[] value, RowMutations mutation) throws IOException;
 
   /**
-   * Set timeout (millisecond) of each operation in this Table instance, will override the
value
-   * of hbase.client.operation.timeout in configuration.
-   * Operation timeout is a top-level restriction that makes sure a blocking method will
not be
-   * blocked more than this. In each operation, if rpc request fails because of timeout or
-   * other reason, it will retry until success or throw a RetriesExhaustedException. But
if the
-   * total time being blocking reach the operation timeout before retries exhausted, it will
break
-   * early and throw SocketTimeoutException.
-   * @param operationTimeout the total timeout of each operation in millisecond.
-   * @deprecated since 2.0.0, use {@link TableBuilder#setOperationTimeout} instead
-   */
-  @Deprecated
-  void setOperationTimeout(int operationTimeout);
-
-  /**
-   * Get timeout (millisecond) of each operation for in Table instance.
+   * Get timeout of each rpc request in this Table instance. It will be overridden by a more
+   * specific rpc timeout config such as readRpcTimeout or writeRpcTimeout.
+   * @see #getReadRpcTimeout(TimeUnit)
+   * @see #getWriteRpcTimeout(TimeUnit)
+   * @param unit the unit of time the timeout to be represented in
+   * @return rpc timeout in the specified time unit
    */
-  int getOperationTimeout();
+  long getRpcTimeout(TimeUnit unit);
 
   /**
    * Get timeout (millisecond) of each rpc request in this Table instance.
    *
    * @return Currently configured read timeout
-   * @deprecated Use getReadRpcTimeout or getWriteRpcTimeout instead
+   * @deprecated use {@link #getReadRpcTimeout(TimeUnit)} or
+   *             {@link #getWriteRpcTimeout(TimeUnit)} instead
    */
   @Deprecated
   int getRpcTimeout();
@@ -703,8 +696,18 @@ public interface Table extends Closeable {
   void setRpcTimeout(int rpcTimeout);
 
   /**
+   * Get timeout of each rpc read request in this Table instance.
+   * @param unit the unit of time the timeout to be represented in
+   * @return read rpc timeout in the specified time unit
+   */
+  long getReadRpcTimeout(TimeUnit unit);
+
+  /**
    * Get timeout (millisecond) of each rpc read request in this Table instance.
+   * @deprecated since 2.0 and will be removed in 3.0 version
+   *             use {@link #getReadRpcTimeout(TimeUnit)} instead
    */
+  @Deprecated
   int getReadRpcTimeout();
 
   /**
@@ -713,15 +716,25 @@ public interface Table extends Closeable {
    * If a rpc read request waiting too long, it will stop waiting and send a new request
to retry
    * until retries exhausted or operation timeout reached.
    *
-   * @param readRpcTimeout
+   * @param readRpcTimeout the timeout for read rpc request in milliseconds
    * @deprecated since 2.0.0, use {@link TableBuilder#setReadRpcTimeout} instead
    */
   @Deprecated
   void setReadRpcTimeout(int readRpcTimeout);
 
   /**
+   * Get timeout of each rpc write request in this Table instance.
+   * @param unit the unit of time the timeout to be represented in
+   * @return write rpc timeout in the specified time unit
+   */
+  long getWriteRpcTimeout(TimeUnit unit);
+
+  /**
    * Get timeout (millisecond) of each rpc write request in this Table instance.
+   * @deprecated since 2.0 and will be removed in 3.0 version
+   *             use {@link #getWriteRpcTimeout(TimeUnit)} instead
    */
+  @Deprecated
   int getWriteRpcTimeout();
 
   /**
@@ -730,9 +743,38 @@ public interface Table extends Closeable {
    * If a rpc write request waiting too long, it will stop waiting and send a new request
to retry
    * until retries exhausted or operation timeout reached.
    *
-   * @param writeRpcTimeout
+   * @param writeRpcTimeout the timeout for write rpc request in milliseconds
    * @deprecated since 2.0.0, use {@link TableBuilder#setWriteRpcTimeout} instead
    */
   @Deprecated
   void setWriteRpcTimeout(int writeRpcTimeout);
+
+  /**
+   * Get timeout of each operation in Table instance.
+   * @param unit the unit of time the timeout to be represented in
+   * @return operation rpc timeout in the specified time unit
+   */
+  long getOperationTimeout(TimeUnit unit);
+
+  /**
+   * Get timeout (millisecond) of each operation for in Table instance.
+   * @deprecated since 2.0 and will be removed in 3.0 version
+   *             use {@link #getOperationTimeout(TimeUnit)} instead
+   */
+  @Deprecated
+  int getOperationTimeout();
+
+  /**
+   * Set timeout (millisecond) of each operation in this Table instance, will override the
value
+   * of hbase.client.operation.timeout in configuration.
+   * Operation timeout is a top-level restriction that makes sure a blocking method will
not be
+   * blocked more than this. In each operation, if rpc request fails because of timeout or
+   * other reason, it will retry until success or throw a RetriesExhaustedException. But
if the
+   * total time being blocking reach the operation timeout before retries exhausted, it will
break
+   * early and throw SocketTimeoutException.
+   * @param operationTimeout the total timeout of each operation in millisecond.
+   * @deprecated since 2.0.0, use {@link TableBuilder#setOperationTimeout} instead
+   */
+  @Deprecated
+  void setOperationTimeout(int operationTimeout);
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/5dadfdaa/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/client/RemoteHTable.java
----------------------------------------------------------------------
diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/client/RemoteHTable.java
b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/client/RemoteHTable.java
index b15537a..5051d47 100644
--- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/client/RemoteHTable.java
+++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/client/RemoteHTable.java
@@ -74,6 +74,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeMap;
+import java.util.concurrent.TimeUnit;
 
 /**
  * HTable interface to remote tables accessed via REST gateway
@@ -864,6 +865,7 @@ public class RemoteHTable implements Table {
   }
 
   @Override
+  @Deprecated
   public int getOperationTimeout() {
     throw new UnsupportedOperationException();
   }
@@ -875,12 +877,23 @@ public class RemoteHTable implements Table {
   }
 
   @Override
+  public long getReadRpcTimeout(TimeUnit unit) {
+    throw new UnsupportedOperationException();
+  }
+
+  @Override
   @Deprecated
   public int getRpcTimeout() {
     throw new UnsupportedOperationException();
   }
 
   @Override
+  public long getRpcTimeout(TimeUnit unit) {
+    throw new UnsupportedOperationException();
+  }
+
+  @Override
+  @Deprecated
   public int getReadRpcTimeout() {
     throw new UnsupportedOperationException();
   }
@@ -891,6 +904,12 @@ public class RemoteHTable implements Table {
   }
 
   @Override
+  public long getWriteRpcTimeout(TimeUnit unit) {
+    throw new UnsupportedOperationException();
+  }
+
+  @Override
+  @Deprecated
   public int getWriteRpcTimeout() {
     throw new UnsupportedOperationException();
   }
@@ -900,6 +919,11 @@ public class RemoteHTable implements Table {
     throw new UnsupportedOperationException();
   }
 
+  @Override
+  public long getOperationTimeout(TimeUnit unit) {
+    throw new UnsupportedOperationException();
+  }
+
   /*
    * Only a small subset of characters are valid in URLs.
    *

http://git-wip-us.apache.org/repos/asf/hbase/blob/5dadfdaa/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/RegionAsTable.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/RegionAsTable.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/RegionAsTable.java
index 3865cb3..f72060d 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/RegionAsTable.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/RegionAsTable.java
@@ -22,10 +22,10 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.Cell;
-import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.CompareOperator;
@@ -353,6 +353,7 @@ public class RegionAsTable implements Table {
   }
 
   @Override
+  @Deprecated
   public int getOperationTimeout() {
     throw new UnsupportedOperationException();
   }
@@ -364,20 +365,42 @@ public class RegionAsTable implements Table {
   }
 
   @Override
+  public long getReadRpcTimeout(TimeUnit unit) {
+    throw new UnsupportedOperationException();
+  }
+
+  @Override
   public void setWriteRpcTimeout(int writeRpcTimeout) {throw new UnsupportedOperationException();
}
 
   @Override
+  public long getOperationTimeout(TimeUnit unit) {
+    throw new UnsupportedOperationException();
+  }
+
+  @Override
   public void setReadRpcTimeout(int readRpcTimeout) {throw new UnsupportedOperationException();
}
 
   @Override
+  public long getWriteRpcTimeout(TimeUnit unit) {
+    throw new UnsupportedOperationException();
+  }
+
+  @Override
   @Deprecated
   public int getRpcTimeout() {
     throw new UnsupportedOperationException();
   }
 
   @Override
+  public long getRpcTimeout(TimeUnit unit) {
+    throw new UnsupportedOperationException();
+  }
+
+  @Override
+  @Deprecated
   public int getWriteRpcTimeout() { throw new UnsupportedOperationException(); }
 
   @Override
+  @Deprecated
   public int getReadRpcTimeout() { throw new UnsupportedOperationException(); }
 }


Mime
View raw message