File tree Expand file tree Collapse file tree 4 files changed +53
-5
lines changed
main/java/org/apache/hadoop/hbase/client
test/java/org/apache/hadoop/hbase/client Expand file tree Collapse file tree 4 files changed +53
-5
lines changed Original file line number Diff line number Diff line change @@ -149,10 +149,11 @@ class AsyncConnectionConfiguration {
149149 private final int maxKeyValueSize ;
150150
151151 AsyncConnectionConfiguration (Configuration conf ) {
152+ long operationTimeoutMs =
153+ conf .getLong (HBASE_CLIENT_OPERATION_TIMEOUT , DEFAULT_HBASE_CLIENT_OPERATION_TIMEOUT );
154+ this .operationTimeoutNs = TimeUnit .MILLISECONDS .toNanos (operationTimeoutMs );
152155 this .metaOperationTimeoutNs = TimeUnit .MILLISECONDS .toNanos (
153- conf .getLong (HBASE_CLIENT_META_OPERATION_TIMEOUT , DEFAULT_HBASE_CLIENT_OPERATION_TIMEOUT ));
154- this .operationTimeoutNs = TimeUnit .MILLISECONDS .toNanos (
155- conf .getLong (HBASE_CLIENT_OPERATION_TIMEOUT , DEFAULT_HBASE_CLIENT_OPERATION_TIMEOUT ));
156+ conf .getLong (HBASE_CLIENT_META_OPERATION_TIMEOUT , operationTimeoutMs ));
156157 long rpcTimeoutMs = conf .getLong (HBASE_RPC_TIMEOUT_KEY , DEFAULT_HBASE_RPC_TIMEOUT );
157158 this .rpcTimeoutNs = TimeUnit .MILLISECONDS .toNanos (rpcTimeoutMs );
158159 long readRpcTimeoutMillis = conf .getLong (HBASE_RPC_READ_TIMEOUT_KEY , rpcTimeoutMs );
Original file line number Diff line number Diff line change @@ -87,7 +87,8 @@ public class ConnectionConfiguration {
8787 WRITE_BUFFER_PERIODIC_FLUSH_TIMERTICK_MS , WRITE_BUFFER_PERIODIC_FLUSH_TIMERTICK_MS_DEFAULT );
8888
8989 this .metaOperationTimeout = conf .getInt (HConstants .HBASE_CLIENT_META_OPERATION_TIMEOUT ,
90- HConstants .DEFAULT_HBASE_CLIENT_OPERATION_TIMEOUT );
90+ conf .getInt (HConstants .HBASE_CLIENT_OPERATION_TIMEOUT ,
91+ HConstants .DEFAULT_HBASE_CLIENT_OPERATION_TIMEOUT ));
9192
9293 this .operationTimeout = conf .getInt (HConstants .HBASE_CLIENT_OPERATION_TIMEOUT ,
9394 HConstants .DEFAULT_HBASE_CLIENT_OPERATION_TIMEOUT );
Original file line number Diff line number Diff line change 3232import org .junit .experimental .categories .Category ;
3333
3434/**
35- * See HBASE-24513.
35+ * See HBASE-24513, HBASE-28608 .
3636 */
3737@ Category ({ ClientTests .class , SmallTests .class })
3838public class TestAsyncConnectionConfiguration {
@@ -69,4 +69,16 @@ public void testDefaultReadWriteRpcTimeout() {
6969 assertEquals (expected , config .getReadRpcTimeoutNs ());
7070 assertEquals (expected , config .getWriteRpcTimeoutNs ());
7171 }
72+
73+ @ Test
74+ public void testDefaultMetaOperationTimeout () {
75+ Configuration conf = HBaseConfiguration .create ();
76+ long timeoutMs = 1000 ;
77+ conf .setLong (HConstants .HBASE_CLIENT_OPERATION_TIMEOUT , timeoutMs );
78+ AsyncConnectionConfiguration config = new AsyncConnectionConfiguration (conf );
79+ long expected = TimeUnit .MILLISECONDS .toNanos (timeoutMs );
80+ assertEquals (expected , config .getOperationTimeoutNs ());
81+ assertEquals (expected , config .getMetaOperationTimeoutNs ());
82+ }
83+
7284}
Original file line number Diff line number Diff line change 1+ package org .apache .hadoop .hbase .client ;
2+
3+ import static org .junit .Assert .assertEquals ;
4+ import org .apache .hadoop .conf .Configuration ;
5+ import org .apache .hadoop .hbase .HBaseClassTestRule ;
6+ import org .apache .hadoop .hbase .HBaseConfiguration ;
7+ import org .apache .hadoop .hbase .HConstants ;
8+ import org .apache .hadoop .hbase .testclassification .ClientTests ;
9+ import org .apache .hadoop .hbase .testclassification .SmallTests ;
10+ import org .junit .ClassRule ;
11+ import org .junit .Test ;
12+ import org .junit .experimental .categories .Category ;
13+
14+ /**
15+ * See HBASE-28608. Configuration tests for (non async) connections
16+ */
17+ @ Category ({ ClientTests .class , SmallTests .class })
18+ public class TestConnectionConfiguration {
19+
20+ @ ClassRule
21+ public static final HBaseClassTestRule CLASS_RULE =
22+ HBaseClassTestRule .forClass (TestConnectionConfiguration .class );
23+
24+ @ Test
25+ public void testDefaultMetaOperationTimeout () {
26+ Configuration conf = HBaseConfiguration .create ();
27+ long clientOperationTimeoutMs = 1000 ;
28+ conf .setLong (HConstants .HBASE_CLIENT_OPERATION_TIMEOUT , clientOperationTimeoutMs );
29+ ConnectionConfiguration config = new ConnectionConfiguration (conf );
30+ assertEquals (clientOperationTimeoutMs , config .getOperationTimeout ());
31+ assertEquals (clientOperationTimeoutMs , config .getMetaOperationTimeout ());
32+ }
33+
34+ }
You can’t perform that action at this time.
0 commit comments