cleanupPoolOnClose = false; ConnectionConfiguration tableConf = new ConnectionConfiguration(conf); this.writeBufferSize = params.getWriteBufferSize() != UNSET ? params.getWriteBufferSize() : tableConf.getWriteBufferSize(); params.getWriteBufferPeriodicFlushTimeoutMs() != UNSET ? params.getWriteBufferPeriodicFlushTimeoutMs() : tableConf.getWriteBufferPeriodicFlushTimeoutMs(); long newWriteBufferPeriodicFlushTimerTickMs = params.getWriteBufferPeriodicFlushTimerTickMs() != UNSET ? params.getWriteBufferPeriodicFlushTimerTickMs() : tableConf.getWriteBufferPeriodicFlushTimerTickMs(); this.setWriteBufferPeriodicFlush( newWriteBufferPeriodicFlushTimeoutMs, params.getMaxKeyValueSize() : tableConf.getMaxKeyValueSize(); params.getRpcTimeout() : conn.getConnectionConfiguration().getWriteRpcTimeout()); params.getOperationTimeout() : conn.getConnectionConfiguration().getOperationTimeout()); this.ap = ap;
connConfiguration.getRetriesNumber(), operationTimeoutMs, readRpcTimeoutMs, connConfiguration.getPrimaryCallTimeoutMicroSecond()); return callable.call(operationTimeoutMs);
TableBuilderBase(TableName tableName, ConnectionConfiguration connConf) { if (tableName == null) { throw new IllegalArgumentException("Given table name is null"); } this.tableName = tableName; this.operationTimeout = tableName.isSystemTable() ? connConf.getMetaOperationTimeout() : connConf.getOperationTimeout(); this.rpcTimeout = connConf.getRpcTimeout(); this.readRpcTimeout = connConf.getReadRpcTimeout(); this.writeRpcTimeout = connConf.getWriteRpcTimeout(); }
params.writeBufferSize(connectionConfig.getWriteBufferSize()); connectionConfig.getWriteBufferPeriodicFlushTimeoutMs()); connectionConfig.getWriteBufferPeriodicFlushTimerTickMs()); params.maxKeyValueSize(connectionConfig.getMaxKeyValueSize());
this.connectionConfig = new ConnectionConfiguration(conf); this.closed = false; this.pause = conf.getLong(HConstants.HBASE_CLIENT_PAUSE, HConstants.DEFAULT_USE_META_REPLICAS); this.metaReplicaCallTimeoutScanInMicroSecond = connectionConfig.getMetaReplicaCallTimeoutMicroSecondScan(); this.numTries = retries2Attempts(connectionConfig.getRetriesNumber()); this.rpcTimeout = conf.getInt( HConstants.HBASE_RPC_TIMEOUT_KEY,
/** * Constructor * @param conn connection to use * @param table to connect to * @param row to locate region with */ RegionCoprocessorRpcChannel(ClusterConnection conn, TableName table, byte[] row) { this.table = table; this.row = row; this.conn = conn; this.operationTimeout = conn.getConnectionConfiguration().getOperationTimeout(); this.rpcCallerFactory = conn.getRpcRetryingCallerFactory(); }
Object[] results = new Object[2]; int operationTimeout = ((ClusterConnection) HTU.getConnection()).getConnectionConfiguration().getOperationTimeout(); int readTimeout = ((ClusterConnection) HTU.getConnection()).getConnectionConfiguration().getReadRpcTimeout(); AsyncProcessTask task = AsyncProcessTask.newBuilder() .setPool(HTable.getDefaultExecutor(HTU.getConfiguration()))
async = connConfiguration.isClientScannerAsyncPrefetch(); return new ReversedClientScanner(getConfiguration(), scan, getName(), this.connection, this.rpcCallerFactory, this.rpcControllerFactory, pool, connConfiguration.getReplicaCallTimeoutMicroSecondScan()); } else { if (async) { return new ClientAsyncPrefetchScanner(getConfiguration(), scan, getName(), this.connection, this.rpcCallerFactory, this.rpcControllerFactory, pool, connConfiguration.getReplicaCallTimeoutMicroSecondScan()); } else { return new ClientSimpleScanner(getConfiguration(), scan, getName(), this.connection, this.rpcCallerFactory, this.rpcControllerFactory, pool, connConfiguration.getReplicaCallTimeoutMicroSecondScan());
@Before public void beforeEach() { this.CONF = new Configuration(); CONF.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, NB_RETRIES); this.CONNECTION_CONFIG = new ConnectionConfiguration(CONF); this.RPC_TIMEOUT = CONF.getInt(HConstants.HBASE_RPC_TIMEOUT_KEY, HConstants.DEFAULT_HBASE_RPC_TIMEOUT); this.OPERATION_TIMEOUT = CONF.getInt(HConstants.HBASE_CLIENT_OPERATION_TIMEOUT, HConstants.DEFAULT_HBASE_CLIENT_OPERATION_TIMEOUT); }
@Test public void testHTablePutSuccess() throws Exception { ClusterConnection conn = createHConnection(); MyAsyncProcess ap = new MyAsyncProcess(conn, CONF); BufferedMutatorParams bufferParam = createBufferedMutatorParams(ap, DUMMY_TABLE); BufferedMutatorImpl ht = new BufferedMutatorImpl(conn, bufferParam, ap); Put put = createPut(1, true); Assert.assertEquals(conn.getConnectionConfiguration().getWriteBufferSize(), ht.getWriteBufferSize()); Assert.assertEquals(0, ht.getCurrentWriteBufferSize()); ht.mutate(put); ht.flush(); Assert.assertEquals(0, ht.getCurrentWriteBufferSize()); }
int primaryCallTimeoutMicroSecond = connection.getConnectionConfiguration().getPrimaryCallTimeoutMicroSecond(); SlowMeCopro.sleepTime.set(TimeUnit.MICROSECONDS.toMillis(primaryCallTimeoutMicroSecond)); SlowMeCopro.getSecondaryCdl().set(new CountDownLatch(1));
public void validatePut(final Put put) throws IllegalArgumentException { validatePut(put, connConfiguration.getMaxKeyValueSize()); }
params.writeBufferSize(connectionConfig.getWriteBufferSize()); connectionConfig.getWriteBufferPeriodicFlushTimeoutMs()); connectionConfig.getWriteBufferPeriodicFlushTimerTickMs()); params.maxKeyValueSize(connectionConfig.getMaxKeyValueSize());
this.user = user; this.batchPool = pool; this.connectionConfig = new ConnectionConfiguration(conf); this.closed = false; this.pause = conf.getLong(HConstants.HBASE_CLIENT_PAUSE, HConstants.DEFAULT_USE_META_REPLICAS); this.metaReplicaCallTimeoutScanInMicroSecond = connectionConfig.getMetaReplicaCallTimeoutMicroSecondScan(); this.numTries = retries2Attempts(connectionConfig.getRetriesNumber()); this.rpcTimeout = conf.getInt( HConstants.HBASE_RPC_TIMEOUT_KEY,
@Override protected Message callExecService(final RpcController controller, final Descriptors.MethodDescriptor method, final Message request, final Message responsePrototype) throws IOException { if (LOG.isTraceEnabled()) { LOG.trace("Call: " + method.getName() + ", " + request.toString()); } // Try-with-resources so close gets called when we are done. try (MasterCallable<CoprocessorServiceResponse> callable = new MasterCallable<CoprocessorServiceResponse>(connection, connection.getRpcControllerFactory()) { @Override protected CoprocessorServiceResponse rpcCall() throws Exception { CoprocessorServiceRequest csr = CoprocessorRpcUtils.getCoprocessorServiceRequest(method, request); return this.master.execMasterService(getRpcController(), csr); } }) { // TODO: Are we retrying here? Does not seem so. We should use RetryingRpcCaller callable.prepare(false); int operationTimeout = connection.getConnectionConfiguration().getOperationTimeout(); CoprocessorServiceResponse result = callable.call(operationTimeout); return CoprocessorRpcUtils.getResponse(result, responsePrototype); } } };
Object[] results = new Object[2]; int operationTimeout = ((ClusterConnection) HTU.getConnection()).getConnectionConfiguration().getOperationTimeout(); int readTimeout = ((ClusterConnection) HTU.getConnection()).getConnectionConfiguration().getReadRpcTimeout(); AsyncProcessTask task = AsyncProcessTask.newBuilder() .setPool(HTable.getDefaultExecutor(HTU.getConfiguration()))
async = connConfiguration.isClientScannerAsyncPrefetch(); return new ReversedClientScanner(getConfiguration(), scan, getName(), this.connection, this.rpcCallerFactory, this.rpcControllerFactory, pool, connConfiguration.getReplicaCallTimeoutMicroSecondScan()); } else { if (async) { return new ClientAsyncPrefetchScanner(getConfiguration(), scan, getName(), this.connection, this.rpcCallerFactory, this.rpcControllerFactory, pool, connConfiguration.getReplicaCallTimeoutMicroSecondScan()); } else { return new ClientSimpleScanner(getConfiguration(), scan, getName(), this.connection, this.rpcCallerFactory, this.rpcControllerFactory, pool, connConfiguration.getReplicaCallTimeoutMicroSecondScan());
private static ClusterConnection createHConnection() throws IOException { ClusterConnection hc = Mockito.mock(ClusterConnection.class); NonceGenerator ng = Mockito.mock(NonceGenerator.class); Mockito.when(ng.getNonceGroup()).thenReturn(HConstants.NO_NONCE); Mockito.when(hc.getNonceGenerator()).thenReturn(ng); Mockito.when(hc.getConfiguration()).thenReturn(CONF); Mockito.when(hc.getConnectionConfiguration()).thenReturn(new ConnectionConfiguration(CONF)); setMockLocation(hc, GOOD_ROW, new RegionLocations(REGION_LOCATION)); setMockLocation(hc, BAD_ROW, new RegionLocations(REGION_LOCATION)); Mockito .when(hc.locateRegions(Mockito.eq(DUMMY_TABLE), Mockito.anyBoolean(), Mockito.anyBoolean())) .thenReturn(Collections.singletonList(REGION_LOCATION)); return hc; }
@Test public void testHTablePutSuccess() throws Exception { ClusterConnection conn = createHConnection(); MyAsyncProcess ap = new MyAsyncProcess(conn, CONF); BufferedMutatorParams bufferParam = createBufferedMutatorParams(ap, DUMMY_TABLE); BufferedMutatorImpl ht = new BufferedMutatorImpl(conn, bufferParam, ap); Put put = createPut(1, true); Assert.assertEquals(conn.getConnectionConfiguration().getWriteBufferSize(), ht.getWriteBufferSize()); Assert.assertEquals(0, ht.getCurrentWriteBufferSize()); ht.mutate(put); ht.flush(); Assert.assertEquals(0, ht.getCurrentWriteBufferSize()); }
int primaryCallTimeoutMicroSecond = connection.getConnectionConfiguration().getPrimaryCallTimeoutMicroSecond(); SlowMeCopro.sleepTime.set(TimeUnit.MICROSECONDS.toMillis(primaryCallTimeoutMicroSecond)); SlowMeCopro.getSecondaryCdl().set(new CountDownLatch(1));