|
36 | 36 | import com.alipay.oceanbase.rpc.protocol.payload.impl.execute.query.*; |
37 | 37 | import com.alipay.oceanbase.rpc.protocol.payload.impl.execute.syncquery.ObTableQueryAsyncRequest; |
38 | 38 | import com.alipay.oceanbase.rpc.stream.ObTableClientQueryAsyncStreamResult; |
39 | | -import com.alipay.oceanbase.rpc.stream.ObTableClientQueryStreamResult; |
40 | 39 | import com.alipay.oceanbase.rpc.table.ObHBaseParams; |
41 | 40 | import com.alipay.oceanbase.rpc.table.ObKVParams; |
42 | 41 | import com.alipay.sofa.common.thread.SofaThreadPoolExecutor; |
@@ -198,8 +197,13 @@ public OHTable(Configuration configuration, String tableName) throws IOException |
198 | 197 | DEFAULT_HBASE_HTABLE_THREAD_KEEP_ALIVE_TIME); |
199 | 198 | this.executePool = createDefaultThreadPoolExecutor(1, maxThreads, keepAliveTime); |
200 | 199 | OHConnectionConfiguration ohConnectionConf = new OHConnectionConfiguration(configuration); |
| 200 | + int numRetries = configuration.getInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, |
| 201 | + HConstants.DEFAULT_HBASE_CLIENT_RETRIES_NUMBER); |
201 | 202 | this.obTableClient = ObTableClientManager.getOrCreateObTableClient(setUserDefinedNamespace( |
202 | 203 | this.tableNameString, ohConnectionConf)); |
| 204 | + this.obTableClient.setRpcExecuteTimeout(ohConnectionConf.getRpcTimeout()); |
| 205 | + this.obTableClient.setRuntimeRetryTimes(numRetries); |
| 206 | + setOperationTimeout(ohConnectionConf.getOperationTimeout()); |
203 | 207 |
|
204 | 208 | finishSetUp(); |
205 | 209 | } |
@@ -246,8 +250,13 @@ public OHTable(Configuration configuration, final byte[] tableName, |
246 | 250 | this.executePool = executePool; |
247 | 251 | this.cleanupPoolOnClose = false; |
248 | 252 | OHConnectionConfiguration ohConnectionConf = new OHConnectionConfiguration(configuration); |
| 253 | + int numRetries = configuration.getInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, |
| 254 | + HConstants.DEFAULT_HBASE_CLIENT_RETRIES_NUMBER); |
249 | 255 | this.obTableClient = ObTableClientManager.getOrCreateObTableClient(setUserDefinedNamespace( |
250 | 256 | this.tableNameString, ohConnectionConf)); |
| 257 | + this.obTableClient.setRpcExecuteTimeout(ohConnectionConf.getRpcTimeout()); |
| 258 | + this.obTableClient.setRuntimeRetryTimes(numRetries); |
| 259 | + setOperationTimeout(ohConnectionConf.getOperationTimeout()); |
251 | 260 |
|
252 | 261 | finishSetUp(); |
253 | 262 | } |
@@ -311,8 +320,15 @@ public OHTable(TableName tableName, Connection connection, |
311 | 320 | DEFAULT_HBASE_HTABLE_PUT_WRITE_BUFFER_CHECK); |
312 | 321 | this.writeBufferSize = connectionConfig.getWriteBufferSize(); |
313 | 322 | this.tableName = tableName.getName(); |
| 323 | + int numRetries = configuration.getInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, |
| 324 | + HConstants.DEFAULT_HBASE_CLIENT_RETRIES_NUMBER); |
314 | 325 | this.obTableClient = ObTableClientManager.getOrCreateObTableClient(setUserDefinedNamespace( |
315 | 326 | this.tableNameString, connectionConfig)); |
| 327 | + this.obTableClient.setRpcExecuteTimeout(rpcTimeout); |
| 328 | + this.obTableClient.setRuntimeRetryTimes(numRetries); |
| 329 | + setOperationTimeout(operationTimeout); |
| 330 | + |
| 331 | + finishSetUp(); |
316 | 332 | } |
317 | 333 |
|
318 | 334 | /** |
@@ -833,7 +849,8 @@ private void validatePut(Put put) { |
833 | 849 | throw new IllegalArgumentException("family is empty"); |
834 | 850 | } |
835 | 851 | for (Cell kv : entry.getValue()) { |
836 | | - if (kv.getRowLength() + kv.getValueLength() + kv.getQualifierLength() + Bytes.toBytes(kv.getTimestamp()).length + kv.getFamilyLength() > maxKeyValueSize) { |
| 852 | + if (kv.getRowLength() + kv.getValueLength() + kv.getQualifierLength() |
| 853 | + + Bytes.toBytes(kv.getTimestamp()).length + kv.getFamilyLength() > maxKeyValueSize) { |
837 | 854 | throw new IllegalArgumentException("KeyValue size too large"); |
838 | 855 | } |
839 | 856 | } |
|
0 commit comments