use of org.apache.hadoop.hbase.client.AsyncClusterConnection in project hbase by apache.
the class HBaseTestingUtil method closeConnection.
public void closeConnection() throws IOException {
if (hbaseAdmin != null) {
Closeables.close(hbaseAdmin, true);
hbaseAdmin = null;
}
AsyncClusterConnection asyncConnection = this.asyncConnection.getAndSet(null);
if (asyncConnection != null) {
Closeables.close(asyncConnection, true);
}
}
use of org.apache.hadoop.hbase.client.AsyncClusterConnection in project hbase by apache.
the class ReplicationSink method getConnection.
private AsyncClusterConnection getConnection() throws IOException {
// See https://en.wikipedia.org/wiki/Double-checked_locking
AsyncClusterConnection connection = sharedConn;
if (connection == null) {
synchronized (sharedConnLock) {
connection = sharedConn;
if (connection == null) {
connection = ClusterConnectionFactory.createAsyncClusterConnection(conf, null, UserProvider.instantiate(conf).getCurrent());
sharedConn = connection;
}
}
}
return connection;
}
use of org.apache.hadoop.hbase.client.AsyncClusterConnection in project hbase by apache.
the class TestBulkLoadHFilesSplitRecovery method testBulkLoadPhaseFailure.
/**
* Test that shows that exception thrown from the RS side will result in an exception on the
* LIHFile client.
*/
@Test(expected = IOException.class)
public void testBulkLoadPhaseFailure() throws Exception {
final TableName table = TableName.valueOf(name.getMethodName());
final AtomicInteger attemptedCalls = new AtomicInteger();
Configuration conf = new Configuration(util.getConfiguration());
conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 2);
BulkLoadHFilesTool loader = new BulkLoadHFilesTool(conf) {
@Override
protected void bulkLoadPhase(AsyncClusterConnection conn, TableName tableName, Deque<LoadQueueItem> queue, Multimap<ByteBuffer, LoadQueueItem> regionGroups, boolean copyFiles, Map<LoadQueueItem, ByteBuffer> item2RegionMap) throws IOException {
AsyncClusterConnection c = attemptedCalls.incrementAndGet() == 1 ? mockAndInjectError(conn) : conn;
super.bulkLoadPhase(c, tableName, queue, regionGroups, copyFiles, item2RegionMap);
}
};
Path dir = buildBulkFiles(table, 1);
loader.bulkLoad(table, dir);
}
use of org.apache.hadoop.hbase.client.AsyncClusterConnection in project hbase by apache.
the class HBaseTestingUtility method closeConnection.
public void closeConnection() throws IOException {
if (hbaseAdmin != null) {
Closeables.close(hbaseAdmin, true);
hbaseAdmin = null;
}
AsyncClusterConnection asyncConnection = this.asyncConnection.getAndSet(null);
if (asyncConnection != null) {
Closeables.close(asyncConnection, true);
}
}
use of org.apache.hadoop.hbase.client.AsyncClusterConnection in project hbase by apache.
the class TestSecureBulkLoadManager method doBulkloadWithoutRetry.
private void doBulkloadWithoutRetry(Path dir) throws Exception {
BulkLoadHFilesTool h = new BulkLoadHFilesTool(conf) {
@Override
protected void bulkLoadPhase(AsyncClusterConnection conn, TableName tableName, Deque<LoadQueueItem> queue, Multimap<ByteBuffer, LoadQueueItem> regionGroups, boolean copyFiles, Map<LoadQueueItem, ByteBuffer> item2RegionMap) throws IOException {
super.bulkLoadPhase(conn, tableName, queue, regionGroups, copyFiles, item2RegionMap);
// throw exception to avoid retry
throw new MyExceptionToAvoidRetry();
}
};
try {
h.bulkLoad(TABLE, dir);
Assert.fail("MyExceptionToAvoidRetry is expected");
} catch (MyExceptionToAvoidRetry e) {
// expected
}
}
Aggregations