HBASE-17555 Changed calls to deprecated getHBaseAdmin to getAdmin

Signed-off-by: Michael Stack <stack@apache.org>
This commit is contained in:
Jan Hentschel 2017-01-27 09:06:52 +01:00 committed by Michael Stack
parent 87e1ba9a1a
commit aff8de8397
206 changed files with 649 additions and 648 deletions

View File

@ -58,7 +58,7 @@ public class TestHelloHBase {
final String NONEXISTENT_NAMESPACE = "xyzpdq_nonexistent";
final String EXISTING_NAMESPACE = "pdqxyz_myExistingNamespace";
boolean exists;
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
exists = HelloHBase.namespaceExists(admin, NONEXISTENT_NAMESPACE);
assertEquals("#namespaceExists failed: found nonexistent namespace.",
@ -74,7 +74,7 @@ public class TestHelloHBase {
@Test
public void testCreateNamespaceAndTable() throws Exception {
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
HelloHBase.createNamespaceAndTable(admin);
boolean namespaceExists
@ -93,7 +93,7 @@ public class TestHelloHBase {
@Test
public void testPutRowToTable() throws IOException {
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
admin.createNamespace
(NamespaceDescriptor.create(HelloHBase.MY_NAMESPACE_NAME).build());
Table table
@ -110,7 +110,7 @@ public class TestHelloHBase {
@Test
public void testDeleteRow() throws IOException {
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
admin.createNamespace
(NamespaceDescriptor.create(HelloHBase.MY_NAMESPACE_NAME).build());
Table table

View File

@ -58,7 +58,7 @@ public class TestHelloHBase {
final String NONEXISTENT_NAMESPACE = "xyzpdq_nonexistent";
final String EXISTING_NAMESPACE = "pdqxyz_myExistingNamespace";
boolean exists;
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
exists = HelloHBase.namespaceExists(admin, NONEXISTENT_NAMESPACE);
assertEquals("#namespaceExists failed: found nonexistent namespace.",
@ -74,7 +74,7 @@ public class TestHelloHBase {
@Test
public void testCreateNamespaceAndTable() throws Exception {
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
HelloHBase.createNamespaceAndTable(admin);
boolean namespaceExists

View File

@ -87,7 +87,7 @@ public class TestBatchCoprocessorEndpoint {
conf.setStrings(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY,
ProtobufCoprocessorService.class.getName());
util.startMiniCluster(2);
Admin admin = util.getHBaseAdmin();
Admin admin = util.getAdmin();
HTableDescriptor desc = new HTableDescriptor(TEST_TABLE);
desc.addFamily(new HColumnDescriptor(TEST_FAMILY));
admin.createTable(desc, new byte[][]{ROWS[rowSeperator1], ROWS[rowSeperator2]});

View File

@ -150,7 +150,7 @@ public class TestClassLoading {
// with configuration values
htd.setValue("COPROCESSOR$2", jarFileOnHDFS2.toString() + "|" + cpName2 +
"|" + Coprocessor.PRIORITY_USER + "|k1=v1,k2=v2,k3=v3");
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
if (admin.tableExists(tableName)) {
if (admin.isTableEnabled(tableName)) {
admin.disableTable(tableName);
@ -231,7 +231,7 @@ public class TestClassLoading {
htd.addFamily(new HColumnDescriptor("test"));
htd.setValue("COPROCESSOR$1", getLocalPath(jarFile) + "|" + cpName3 + "|" +
Coprocessor.PRIORITY_USER);
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
admin.createTable(htd);
waitForTable(htd.getTableName());
@ -256,7 +256,7 @@ public class TestClassLoading {
htd.addFamily(new HColumnDescriptor("test"));
htd.setValue("COPROCESSOR$1", getLocalPath(jarFile) + "|" + cpName4 + "|" +
Coprocessor.PRIORITY_USER);
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
admin.createTable(htd);
waitForTable(htd.getTableName());
@ -317,7 +317,7 @@ public class TestClassLoading {
htd.addCoprocessor(cpName6, new Path(getLocalPath(jarFile6)),
Coprocessor.PRIORITY_USER, kvs);
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
if (admin.tableExists(tableName)) {
if (admin.isTableEnabled(tableName)) {
admin.disableTable(tableName);
@ -408,7 +408,7 @@ public class TestClassLoading {
// with configuration values
htd.setValue("COPROCESSOR$2", jarFileOnHDFS.toString() + "|" + cpName2 +
"|" + Coprocessor.PRIORITY_USER + "|k1=v1,k2=v2,k3=v3");
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
if (admin.tableExists(tableName)) {
if (admin.isTableEnabled(tableName)) {
admin.disableTable(tableName);

View File

@ -94,7 +94,7 @@ public class TestCoprocessorEndpoint {
conf.setStrings(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY,
ProtobufCoprocessorService.class.getName());
util.startMiniCluster(2);
Admin admin = util.getHBaseAdmin();
Admin admin = util.getAdmin();
HTableDescriptor desc = new HTableDescriptor(TEST_TABLE);
desc.addFamily(new HColumnDescriptor(TEST_FAMILY));
admin.createTable(desc, new byte[][]{ROWS[rowSeperator1], ROWS[rowSeperator2]});
@ -296,7 +296,7 @@ public class TestCoprocessorEndpoint {
@Test
public void testMasterCoprocessorService() throws Throwable {
Admin admin = util.getHBaseAdmin();
Admin admin = util.getAdmin();
final TestProtos.EchoRequestProto request =
TestProtos.EchoRequestProto.newBuilder().setMessage("hello").build();
TestRpcServiceProtos.TestProtobufRpcProto.BlockingInterface service =
@ -327,7 +327,7 @@ public class TestCoprocessorEndpoint {
@Test
public void testMasterCoprocessorError() throws Throwable {
Admin admin = util.getHBaseAdmin();
Admin admin = util.getAdmin();
TestRpcServiceProtos.TestProtobufRpcProto.BlockingInterface service =
TestRpcServiceProtos.TestProtobufRpcProto.newBlockingStub(admin.coprocessorService());
try {

View File

@ -126,7 +126,7 @@ public class TestCoprocessorTableEndpoint {
}
private static final void createTable(HTableDescriptor desc) throws Exception {
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
admin.createTable(desc, new byte[][]{ROWS[rowSeperator1], ROWS[rowSeperator2]});
TEST_UTIL.waitUntilAllRegionsAssigned(desc.getTableName());
Table table = TEST_UTIL.getConnection().getTable(desc.getTableName());
@ -142,7 +142,7 @@ public class TestCoprocessorTableEndpoint {
}
private static void updateTable(HTableDescriptor desc) throws Exception {
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
admin.disableTable(desc.getTableName());
admin.modifyTable(desc.getTableName(), desc);
admin.enableTable(desc.getTableName());

View File

@ -77,7 +77,7 @@ public class TestRegionServerCoprocessorEndpoint {
new CoprocessorRpcUtils.BlockingRpcCallback<DummyRegionServerEndpointProtos.DummyResponse>();
DummyRegionServerEndpointProtos.DummyService service =
ProtobufUtil.newServiceStub(DummyRegionServerEndpointProtos.DummyService.class,
TEST_UTIL.getHBaseAdmin().coprocessorService(serverName));
TEST_UTIL.getAdmin().coprocessorService(serverName));
service.dummyCall(controller,
DummyRegionServerEndpointProtos.DummyRequest.getDefaultInstance(), rpcCallback);
assertEquals(DUMMY_VALUE, rpcCallback.get().getValue());
@ -95,7 +95,7 @@ public class TestRegionServerCoprocessorEndpoint {
new CoprocessorRpcUtils.BlockingRpcCallback<DummyRegionServerEndpointProtos.DummyResponse>();
DummyRegionServerEndpointProtos.DummyService service =
ProtobufUtil.newServiceStub(DummyRegionServerEndpointProtos.DummyService.class,
TEST_UTIL.getHBaseAdmin().coprocessorService(serverName));
TEST_UTIL.getAdmin().coprocessorService(serverName));
service.dummyThrow(controller,
DummyRegionServerEndpointProtos.DummyRequest.getDefaultInstance(), rpcCallback);
assertEquals(null, rpcCallback.get());

View File

@ -132,8 +132,8 @@ public class TestRowProcessorEndpoint {
public void prepareTestData() throws Exception {
try {
util.getHBaseAdmin().disableTable(TABLE);
util.getHBaseAdmin().deleteTable(TABLE);
util.getAdmin().disableTable(TABLE);
util.getAdmin().deleteTable(TABLE);
} catch (Exception e) {
// ignore table not found
}

View File

@ -151,7 +151,7 @@ public class IntegrationTestIngest extends IntegrationTestBase {
}
private void deleteTableIfNecessary() throws IOException {
if (util.getHBaseAdmin().tableExists(getTablename())) {
if (util.getAdmin().tableExists(getTablename())) {
util.deleteTable(getTablename());
}
}

View File

@ -93,7 +93,7 @@ public class IntegrationTestIngestWithEncryption extends IntegrationTestIngest {
// Update the test table schema so HFiles from this point will be written with
// encryption features enabled.
final Admin admin = util.getHBaseAdmin();
final Admin admin = util.getAdmin();
HTableDescriptor tableDescriptor =
new HTableDescriptor(admin.getTableDescriptor(getTablename()));
for (HColumnDescriptor columnDescriptor: tableDescriptor.getColumnFamilies()) {

View File

@ -198,12 +198,12 @@ public class IntegrationTestLazyCfLoading {
}
int serverCount = util.getHBaseClusterInterface().getClusterStatus().getServersSize();
byte[][] splits = new RegionSplitter.HexStringSplit().split(serverCount * REGIONS_PER_SERVER);
util.getHBaseAdmin().createTable(htd, splits);
util.getAdmin().createTable(htd, splits);
LOG.info("Created table");
}
private void deleteTable() throws Exception {
if (util.getHBaseAdmin().tableExists(TABLE_NAME)) {
if (util.getAdmin().tableExists(TABLE_NAME)) {
LOG.info("Deleting table");
util.deleteTable(TABLE_NAME);
LOG.info("Deleted table");

View File

@ -85,7 +85,7 @@ public class IntegrationTestManyRegions {
UTIL.initializeCluster(REGION_SERVER_COUNT);
LOG.info("Cluster initialized");
admin = UTIL.getHBaseAdmin();
admin = UTIL.getAdmin();
if (admin.tableExists(TABLE_NAME)) {
LOG.info(String.format("Deleting existing table %s.", TABLE_NAME));
if (admin.isTableEnabled(TABLE_NAME)) admin.disableTable(TABLE_NAME);

View File

@ -271,18 +271,18 @@ public class IntegrationTestRegionReplicaPerf extends IntegrationTestBase {
// create/populate the table, replicas disabled
LOG.debug("Populating table.");
new PerfEvalCallable(util.getHBaseAdmin(), writeOpts).call();
new PerfEvalCallable(util.getAdmin(), writeOpts).call();
// one last sanity check, then send in the clowns!
assertEquals("Table must be created with DisabledRegionSplitPolicy. Broken test.",
DisabledRegionSplitPolicy.class.getName(),
util.getHBaseAdmin().getTableDescriptor(tableName).getRegionSplitPolicyClassName());
util.getAdmin().getTableDescriptor(tableName).getRegionSplitPolicyClassName());
startMonkey();
// collect a baseline without region replicas.
for (int i = 0; i < maxIters; i++) {
LOG.debug("Launching non-replica job " + (i + 1) + "/" + maxIters);
resultsWithoutReplicas.add(new PerfEvalCallable(util.getHBaseAdmin(), readOpts).call());
resultsWithoutReplicas.add(new PerfEvalCallable(util.getAdmin(), readOpts).call());
// TODO: sleep to let cluster stabilize, though monkey continues. is it necessary?
Thread.sleep(5000l);
}
@ -290,14 +290,14 @@ public class IntegrationTestRegionReplicaPerf extends IntegrationTestBase {
// disable monkey, enable region replicas, enable monkey
cleanUpMonkey("Altering table.");
LOG.debug("Altering " + tableName + " replica count to " + replicaCount);
IntegrationTestingUtility.setReplicas(util.getHBaseAdmin(), tableName, replicaCount);
IntegrationTestingUtility.setReplicas(util.getAdmin(), tableName, replicaCount);
setUpMonkey();
startMonkey();
// run test with region replicas.
for (int i = 0; i < maxIters; i++) {
LOG.debug("Launching replica job " + (i + 1) + "/" + maxIters);
resultsWithReplicas.add(new PerfEvalCallable(util.getHBaseAdmin(), replicaReadOpts).call());
resultsWithReplicas.add(new PerfEvalCallable(util.getAdmin(), replicaReadOpts).call());
// TODO: sleep to let cluster stabilize, though monkey continues. is it necessary?
Thread.sleep(5000l);
}

View File

@ -138,7 +138,7 @@ public class IntegrationTestingUtility extends HBaseTestingUtility {
ClusterManager clusterManager = ReflectionUtils.newInstance(
clusterManagerClass, conf);
setHBaseCluster(new DistributedHBaseCluster(conf, clusterManager));
getHBaseAdmin();
getAdmin();
}
}

View File

@ -172,12 +172,12 @@ public class StripeCompactionsPerformanceEvaluation extends AbstractHBaseTool {
}
protected void deleteTable() throws Exception {
if (util.getHBaseAdmin().tableExists(TABLE_NAME)) {
if (util.getAdmin().tableExists(TABLE_NAME)) {
LOG.info("Deleting table");
if (!util.getHBaseAdmin().isTableDisabled(TABLE_NAME)) {
util.getHBaseAdmin().disableTable(TABLE_NAME);
if (!util.getAdmin().isTableDisabled(TABLE_NAME)) {
util.getAdmin().disableTable(TABLE_NAME);
}
util.getHBaseAdmin().deleteTable(TABLE_NAME);
util.getAdmin().deleteTable(TABLE_NAME);
LOG.info("Deleted table");
}
}
@ -297,7 +297,7 @@ public class StripeCompactionsPerformanceEvaluation extends AbstractHBaseTool {
}
byte[][] splits = new RegionSplitter.HexStringSplit().split(
util.getHBaseClusterInterface().getClusterStatus().getServersSize());
util.getHBaseAdmin().createTable(htd, splits);
util.getAdmin().createTable(htd, splits);
}
public static class SeqShardedDataGenerator extends LoadTestDataGenerator {

View File

@ -208,7 +208,7 @@ public class Action {
LOG.info("Moving " + victimRegions.size() + " regions from " + fromServers.size()
+ " servers to " + toServers.size() + " different servers");
Admin admin = this.context.getHBaseIntegrationTestingUtility().getHBaseAdmin();
Admin admin = this.context.getHBaseIntegrationTestingUtility().getAdmin();
for (byte[] victimRegion : victimRegions) {
// Don't keep moving regions if we're
// trying to stop the monkey.
@ -221,7 +221,7 @@ public class Action {
}
protected void forceBalancer() throws Exception {
Admin admin = this.context.getHBaseIntegrationTestingUtility().getHBaseAdmin();
Admin admin = this.context.getHBaseIntegrationTestingUtility().getAdmin();
boolean result = false;
try {
result = admin.balancer();

View File

@ -40,7 +40,7 @@ public class AddColumnAction extends Action {
@Override
public void init(ActionContext context) throws IOException {
super.init(context);
this.admin = context.getHBaseIntegrationTestingUtility().getHBaseAdmin();
this.admin = context.getHBaseIntegrationTestingUtility().getAdmin();
}
@Override

View File

@ -48,7 +48,7 @@ public class ChangeBloomFilterAction extends Action {
public void perform() throws Exception {
Random random = new Random();
HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
Admin admin = util.getHBaseAdmin();
Admin admin = util.getAdmin();
LOG.info("Performing action: Change bloom filter on all columns of table "
+ tableName);

View File

@ -45,7 +45,7 @@ public class ChangeCompressionAction extends Action {
@Override
public void init(ActionContext context) throws IOException {
super.init(context);
this.admin = context.getHBaseIntegrationTestingUtility().getHBaseAdmin();
this.admin = context.getHBaseIntegrationTestingUtility().getAdmin();
}
@Override

View File

@ -44,7 +44,7 @@ public class ChangeEncodingAction extends Action {
@Override
public void init(ActionContext context) throws IOException {
super.init(context);
this.admin = context.getHBaseIntegrationTestingUtility().getHBaseAdmin();
this.admin = context.getHBaseIntegrationTestingUtility().getAdmin();
}
@Override

View File

@ -46,7 +46,7 @@ public class ChangeSplitPolicyAction extends Action {
@Override
public void perform() throws Exception {
HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
Admin admin = util.getHBaseAdmin();
Admin admin = util.getAdmin();
LOG.info("Performing action: Change split policy of table " + tableName);
HTableDescriptor tableDescriptor = admin.getTableDescriptor(tableName);

View File

@ -45,7 +45,7 @@ public class ChangeVersionsAction extends Action {
@Override
public void init(ActionContext context) throws IOException {
super.init(context);
this.admin = context.getHBaseIntegrationTestingUtility().getHBaseAdmin();
this.admin = context.getHBaseIntegrationTestingUtility().getAdmin();
}
@Override

View File

@ -46,7 +46,7 @@ public class CompactMobAction extends Action {
@Override
public void perform() throws Exception {
HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
Admin admin = util.getHBaseAdmin();
Admin admin = util.getAdmin();
boolean major = RandomUtils.nextInt(100) < majorRatio;
// Don't try the modify if we're stopping

View File

@ -50,7 +50,7 @@ public class CompactRandomRegionOfTableAction extends Action {
@Override
public void perform() throws Exception {
HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
Admin admin = util.getHBaseAdmin();
Admin admin = util.getAdmin();
boolean major = RandomUtils.nextInt(100) < majorRatio;
LOG.info("Performing action: Compact random region of table "

View File

@ -45,7 +45,7 @@ public class CompactTableAction extends Action {
@Override
public void perform() throws Exception {
HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
Admin admin = util.getHBaseAdmin();
Admin admin = util.getAdmin();
boolean major = RandomUtils.nextInt(100) < majorRatio;
LOG.info("Performing action: Compact table " + tableName + ", major=" + major);

View File

@ -43,7 +43,7 @@ public class DecreaseMaxHFileSizeAction extends Action {
@Override
public void perform() throws Exception {
HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
Admin admin = util.getHBaseAdmin();
Admin admin = util.getAdmin();
HTableDescriptor htd = admin.getTableDescriptor(tableName);
// Try and get the current value.

View File

@ -45,7 +45,7 @@ public class FlushRandomRegionOfTableAction extends Action {
@Override
public void perform() throws Exception {
HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
Admin admin = util.getHBaseAdmin();
Admin admin = util.getAdmin();
LOG.info("Performing action: Flush random region of table " + tableName);
List<HRegionInfo> regions = admin.getTableRegions(tableName);

View File

@ -41,7 +41,7 @@ public class FlushTableAction extends Action {
@Override
public void perform() throws Exception {
HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
Admin admin = util.getHBaseAdmin();
Admin admin = util.getAdmin();
// Don't try the flush if we're stopping
if (context.isStopping()) {

View File

@ -45,7 +45,7 @@ public class MergeRandomAdjacentRegionsOfTableAction extends Action {
@Override
public void perform() throws Exception {
HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
Admin admin = util.getHBaseAdmin();
Admin admin = util.getAdmin();
LOG.info("Performing action: Merge random adjacent regions of table " + tableName);
List<HRegionInfo> regions = admin.getTableRegions(tableName);

View File

@ -49,7 +49,7 @@ public class MoveRandomRegionOfTableAction extends Action {
}
HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
Admin admin = util.getHBaseAdmin();
Admin admin = util.getAdmin();
LOG.info("Performing action: Move random region of table " + tableName);
List<HRegionInfo> regions = admin.getTableRegions(tableName);

View File

@ -54,7 +54,7 @@ public class MoveRegionsOfTableAction extends Action {
Thread.sleep(sleepTime);
}
Admin admin = this.context.getHBaseIntegrationTestingUtility().getHBaseAdmin();
Admin admin = this.context.getHBaseIntegrationTestingUtility().getAdmin();
Collection<ServerName> serversList = admin.getClusterStatus().getServers();
ServerName[] servers = serversList.toArray(new ServerName[serversList.size()]);

View File

@ -46,7 +46,7 @@ public class RemoveColumnAction extends Action {
@Override
public void init(ActionContext context) throws IOException {
super.init(context);
this.admin = context.getHBaseIntegrationTestingUtility().getHBaseAdmin();
this.admin = context.getHBaseIntegrationTestingUtility().getAdmin();
}
@Override

View File

@ -42,7 +42,7 @@ public class SnapshotTableAction extends Action {
public void perform() throws Exception {
HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
String snapshotName = tableName + "-it-" + System.currentTimeMillis();
Admin admin = util.getHBaseAdmin();
Admin admin = util.getAdmin();
// Don't try the snapshot if we're stopping
if (context.isStopping()) {

View File

@ -46,7 +46,7 @@ public class SplitAllRegionOfTableAction extends Action {
@Override
public void perform() throws Exception {
HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
Admin admin = util.getHBaseAdmin();
Admin admin = util.getAdmin();
// Don't try the split if we're stopping
if (context.isStopping()) {
return;

View File

@ -45,7 +45,7 @@ public class SplitRandomRegionOfTableAction extends Action {
@Override
public void perform() throws Exception {
HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
Admin admin = util.getHBaseAdmin();
Admin admin = util.getAdmin();
LOG.info("Performing action: Split random region of table " + tableName);
List<HRegionInfo> regions = admin.getTableRegions(tableName);

View File

@ -39,7 +39,7 @@ public class TruncateTableAction extends Action {
@Override
public void perform() throws Exception {
HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
Admin admin = util.getHBaseAdmin();
Admin admin = util.getAdmin();
// Don't try the truncate if we're stopping
if (context.isStopping()) {

View File

@ -201,7 +201,7 @@ public class IntegrationTestBulkLoad extends IntegrationTestBase {
if (replicaCount == NUM_REPLICA_COUNT_DEFAULT) return;
TableName t = getTablename();
Admin admin = util.getHBaseAdmin();
Admin admin = util.getAdmin();
HTableDescriptor desc = admin.getTableDescriptor(t);
desc.addCoprocessor(SlowMeCoproScanOperations.class.getName());
HBaseTestingUtility.modifyTableSync(admin, desc);
@ -231,7 +231,7 @@ public class IntegrationTestBulkLoad extends IntegrationTestBase {
}
private void setupTable() throws IOException, InterruptedException {
if (util.getHBaseAdmin().tableExists(getTablename())) {
if (util.getAdmin().tableExists(getTablename())) {
util.deleteTable(getTablename());
}
@ -245,7 +245,7 @@ public class IntegrationTestBulkLoad extends IntegrationTestBase {
if (replicaCount == NUM_REPLICA_COUNT_DEFAULT) return;
TableName t = getTablename();
HBaseTestingUtility.setReplicas(util.getHBaseAdmin(), t, replicaCount);
HBaseTestingUtility.setReplicas(util.getAdmin(), t, replicaCount);
}
private void runLinkedListMRJob(int iteration) throws Exception {
@ -746,7 +746,7 @@ public class IntegrationTestBulkLoad extends IntegrationTestBase {
// Scale this up on a real cluster
if (util.isDistributedCluster()) {
util.getConfiguration().setIfUnset(NUM_MAPS_KEY,
Integer.toString(util.getHBaseAdmin().getClusterStatus().getServersSize() * 10)
Integer.toString(util.getAdmin().getClusterStatus().getServersSize() * 10)
);
util.getConfiguration().setIfUnset(NUM_IMPORT_ROUNDS_KEY, "5");
} else {

View File

@ -223,11 +223,11 @@ public class IntegrationTestMTTR {
loadTableName = TableName.valueOf(util.getConfiguration()
.get("hbase.IntegrationTestMTTR.loadTableName", "IntegrationTestMTTRLoadTestTool"));
if (util.getHBaseAdmin().tableExists(tableName)) {
if (util.getAdmin().tableExists(tableName)) {
util.deleteTable(tableName);
}
if (util.getHBaseAdmin().tableExists(loadTableName)) {
if (util.getAdmin().tableExists(loadTableName)) {
util.deleteTable(loadTableName);
}
@ -240,7 +240,7 @@ public class IntegrationTestMTTR {
HColumnDescriptor descriptor = new HColumnDescriptor(FAMILY);
descriptor.setMaxVersions(1);
tableDescriptor.addFamily(descriptor);
util.getHBaseAdmin().createTable(tableDescriptor);
util.getAdmin().createTable(tableDescriptor);
// Setup the table for LoadTestTool
int ret = loadTool.run(new String[]{"-tn", loadTableName.getNameAsString(), "-init_only"});
@ -557,7 +557,7 @@ public class IntegrationTestMTTR {
protected boolean doAction() throws Exception {
Admin admin = null;
try {
admin = util.getHBaseAdmin();
admin = util.getAdmin();
ClusterStatus status = admin.getClusterStatus();
return status != null;
} finally {

View File

@ -47,7 +47,7 @@ public class IntegrationTestRSGroup extends TestRSGroupsBase {
TEST_UTIL = new IntegrationTestingUtility();
((IntegrationTestingUtility)TEST_UTIL).initializeCluster(NUM_SLAVES_BASE);
//set shared configs
admin = TEST_UTIL.getHBaseAdmin();
admin = TEST_UTIL.getAdmin();
cluster = TEST_UTIL.getHBaseClusterInterface();
rsGroupAdmin = new VerifyingRSGroupAdminClient(rsGroupAdmin.newClient(TEST_UTIL.getConnection()),
TEST_UTIL.getConfiguration());

View File

@ -538,7 +538,7 @@ public void cleanUpCluster() throws Exception {
HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(TEST_NAME));
htd.addFamily(new HColumnDescriptor(TEST_FAMILY));
Admin admin = getTestingUtil(getConf()).getHBaseAdmin();
Admin admin = getTestingUtil(getConf()).getAdmin();
admin.createTable(htd, Bytes.toBytes(0L), Bytes.toBytes(-1L), 40);
doLoad(getConf(), htd);

View File

@ -159,7 +159,7 @@ public class IntegrationTestTimeBoundedRequestsWithRegionReplicas extends Integr
// flush the table
LOG.info("Flushing the table");
Admin admin = util.getHBaseAdmin();
Admin admin = util.getAdmin();
admin.flush(getTablename());
// re-open the regions to make sure that the replicas are up to date

View File

@ -94,7 +94,7 @@ public class IntegrationTestSendTraceRequests extends AbstractHBaseTool {
@Test
public void internalDoWork() throws Exception {
util = createUtil();
admin = util.getHBaseAdmin();
admin = util.getAdmin();
setupReceiver();
deleteTable();

View File

@ -107,7 +107,7 @@ public class RowResourceBase {
@Before
public void beforeMethod() throws Exception {
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
if (admin.tableExists(TABLE_NAME)) {
TEST_UTIL.deleteTable(TABLE_NAME);
}
@ -119,7 +119,7 @@ public class RowResourceBase {
@After
public void afterMethod() throws Exception {
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
if (admin.tableExists(TABLE_NAME)) {
TEST_UTIL.deleteTable(TABLE_NAME);
}

View File

@ -68,7 +68,7 @@ public class TestGzipFilter {
REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
client = new Client(new Cluster().add("localhost",
REST_TEST_UTIL.getServletPort()));
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
if (admin.tableExists(TABLE)) {
return;
}

View File

@ -107,7 +107,7 @@ public class TestMultiRowResource {
marshaller = context.createMarshaller();
unmarshaller = context.createUnmarshaller();
client = new Client(new Cluster().add("localhost", REST_TEST_UTIL.getServletPort()));
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
if (admin.tableExists(TABLE)) {
return;
}

View File

@ -152,7 +152,7 @@ public class TestNamespacesInstanceResource {
Response response;
// Check that doesn't exist via non-REST call.
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
assertNotNull(findNamespace(admin, "default"));
assertNotNull(findNamespace(admin, "hbase"));
@ -168,7 +168,7 @@ public class TestNamespacesInstanceResource {
@Test
public void testGetNamespaceTablesAndCannotDeleteNamespace() throws IOException, JAXBException {
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
String nsName = "TestNamespacesInstanceResource5";
Response response;
@ -251,7 +251,7 @@ public class TestNamespacesInstanceResource {
Response response;
// Check that namespaces don't exist via non-REST call.
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
assertNull(findNamespace(admin, NAMESPACE1));
assertNull(findNamespace(admin, NAMESPACE2));
assertNull(findNamespace(admin, NAMESPACE3));
@ -289,7 +289,7 @@ public class TestNamespacesInstanceResource {
Response response;
// Check that namespaces don't exist via non-REST call.
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
assertNull(findNamespace(admin, NAMESPACE1));
assertNull(findNamespace(admin, NAMESPACE2));
@ -365,7 +365,7 @@ public class TestNamespacesInstanceResource {
Response response;
// Check that namespaces don't exist via non-REST call.
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
assertNull(findNamespace(admin, NAMESPACE3));
assertNull(findNamespace(admin, NAMESPACE4));

View File

@ -101,7 +101,7 @@ public class TestNamespacesResource {
Response response;
// Check that namespace does not yet exist via non-REST call.
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
assertFalse(doesNamespaceExist(admin, NAMESPACE1));
model = testNamespacesModel.buildTestModel();
testNamespacesModel.checkModel(model);
@ -159,7 +159,7 @@ public class TestNamespacesResource {
Response response;
// Check that namespace does not yet exist via non-REST call.
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
assertFalse(doesNamespaceExist(admin, NAMESPACE1));
model = testNamespacesModel.buildTestModel();
testNamespacesModel.checkModel(model);

View File

@ -175,7 +175,7 @@ public class TestScannerResource {
ScannerModel.class);
marshaller = context.createMarshaller();
unmarshaller = context.createUnmarshaller();
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
if (admin.tableExists(TABLE)) {
return;
}

View File

@ -137,7 +137,7 @@ public class TestScannersWithFilters {
unmarshaller = context.createUnmarshaller();
client = new Client(new Cluster().add("localhost",
REST_TEST_UTIL.getServletPort()));
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
if (!admin.tableExists(TABLE)) {
HTableDescriptor htd = new HTableDescriptor(TABLE);
htd.addFamily(new HColumnDescriptor(FAMILIES[0]));

View File

@ -145,7 +145,7 @@ public class TestScannersWithLabels {
ScannerModel.class);
marshaller = context.createMarshaller();
unmarshaller = context.createUnmarshaller();
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
if (admin.tableExists(TABLE)) {
return;
}

View File

@ -122,7 +122,7 @@ public class TestSchemaResource {
TableSchemaModel model;
Response response;
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
assertFalse(admin.tableExists(TableName.valueOf(TABLE1)));
// create the table
@ -181,7 +181,7 @@ public class TestSchemaResource {
TableSchemaModel model;
Response response;
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
assertFalse(admin.tableExists(TableName.valueOf(TABLE2)));
// create the table

View File

@ -91,7 +91,7 @@ public class TestTableResource {
TableInfoModel.class,
TableListModel.class,
TableRegionModel.class);
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
if (admin.tableExists(TABLE)) {
return;
}

View File

@ -99,7 +99,7 @@ public class TestTableScan {
REST_TEST_UTIL.startServletContainer(conf);
client = new Client(new Cluster().add("localhost",
REST_TEST_UTIL.getServletPort()));
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
if (!admin.tableExists(TABLE)) {
HTableDescriptor htd = new HTableDescriptor(TABLE);
htd.addFamily(new HColumnDescriptor(CFA));
@ -112,8 +112,8 @@ public class TestTableScan {
@AfterClass
public static void tearDownAfterClass() throws Exception {
TEST_UTIL.getHBaseAdmin().disableTable(TABLE);
TEST_UTIL.getHBaseAdmin().deleteTable(TABLE);
TEST_UTIL.getAdmin().disableTable(TABLE);
TEST_UTIL.getAdmin().deleteTable(TABLE);
REST_TEST_UTIL.shutdownServletContainer();
TEST_UTIL.shutdownMiniCluster();
}

View File

@ -108,7 +108,7 @@ public class TestRemoteTable {
@Before
public void before() throws Exception {
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
if (admin.tableExists(TABLE)) {
if (admin.isTableEnabled(TABLE)) admin.disableTable(TABLE);
admin.deleteTable(TABLE);

View File

@ -80,7 +80,7 @@ public class TestRSGroups extends TestRSGroupsBase {
ServerManager.WAIT_ON_REGIONSERVERS_MINTOSTART,
""+NUM_SLAVES_BASE);
admin = TEST_UTIL.getHBaseAdmin();
admin = TEST_UTIL.getAdmin();
cluster = TEST_UTIL.getHBaseCluster();
master = ((MiniHBaseCluster)cluster).getMaster();

View File

@ -35,8 +35,8 @@ import org.apache.hadoop.hbase.RegionLoad;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.Waiter;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.ClusterConnection;
import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.constraint.ConstraintException;
import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos;
@ -68,7 +68,7 @@ public abstract class TestRSGroupsBase {
//shared, cluster type specific
protected static HBaseTestingUtility TEST_UTIL;
protected static HBaseAdmin admin;
protected static Admin admin;
protected static HBaseCluster cluster;
protected static RSGroupAdmin rsGroupAdmin;
@ -106,13 +106,13 @@ public abstract class TestRSGroupsBase {
}
protected void deleteTableIfNecessary() throws IOException {
for (HTableDescriptor desc : TEST_UTIL.getHBaseAdmin().listTables(tablePrefix+".*")) {
for (HTableDescriptor desc : TEST_UTIL.getAdmin().listTables(tablePrefix+".*")) {
TEST_UTIL.deleteTable(desc.getTableName());
}
}
protected void deleteNamespaceIfNecessary() throws IOException {
for (NamespaceDescriptor desc : TEST_UTIL.getHBaseAdmin().listNamespaceDescriptors()) {
for (NamespaceDescriptor desc : TEST_UTIL.getAdmin().listNamespaceDescriptors()) {
if(desc.getName().startsWith(tablePrefix)) {
admin.deleteNamespace(desc.getName());
}
@ -496,7 +496,7 @@ public abstract class TestRSGroupsBase {
});
// Lets move this region to the new group.
TEST_UTIL.getHBaseAdmin().move(Bytes.toBytes(HRegionInfo.encodeRegionName(Bytes.toBytes(targetRegion))),
TEST_UTIL.getAdmin().move(Bytes.toBytes(HRegionInfo.encodeRegionName(Bytes.toBytes(targetRegion))),
Bytes.toBytes(targetServer.getServerName()));
TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() {
@Override

View File

@ -28,7 +28,7 @@ import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.MiniHBaseCluster;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.Waiter;
import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
import org.apache.hadoop.hbase.master.HMaster;
import org.apache.hadoop.hbase.master.ServerManager;
@ -54,7 +54,7 @@ public class TestRSGroupsOfflineMode {
private static final org.apache.commons.logging.Log LOG =
LogFactory.getLog(TestRSGroupsOfflineMode.class);
private static HMaster master;
private static HBaseAdmin hbaseAdmin;
private static Admin hbaseAdmin;
private static HBaseTestingUtility TEST_UTIL;
private static HBaseCluster cluster;
private static RSGroupAdminEndpoint RSGroupAdminEndpoint;
@ -75,7 +75,7 @@ public class TestRSGroupsOfflineMode {
cluster = TEST_UTIL.getHBaseCluster();
master = ((MiniHBaseCluster)cluster).getMaster();
master.balanceSwitch(false);
hbaseAdmin = TEST_UTIL.getHBaseAdmin();
hbaseAdmin = TEST_UTIL.getAdmin();
//wait till the balancer is in online mode
TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() {
@Override

View File

@ -84,12 +84,12 @@ public class TestAcidGuarantees implements Tool {
}
if (useMob) {
HTableDescriptor htd = util.getHBaseAdmin().getTableDescriptor(TABLE_NAME);
HTableDescriptor htd = util.getAdmin().getTableDescriptor(TABLE_NAME);
HColumnDescriptor hcd = htd.getColumnFamilies()[0];
// force mob enabled such that all data is mob data
hcd.setMobEnabled(true);
hcd.setMobThreshold(4);
util.getHBaseAdmin().modifyColumnFamily(TABLE_NAME, hcd);
util.getAdmin().modifyColumnFamily(TABLE_NAME, hcd);
}
}
@ -337,7 +337,7 @@ public class TestAcidGuarantees implements Tool {
}
// Add a flusher
ctx.addThread(new RepeatingTestThread(ctx) {
Admin admin = util.getHBaseAdmin();
Admin admin = util.getAdmin();
public void doAnAction() throws Exception {
try {
admin.flush(TABLE_NAME);

View File

@ -74,7 +74,7 @@ public class TestHColumnDescriptorDefaultVersions {
@Test
public void testCreateTableWithDefault() throws IOException {
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
// Create a table with one family
HTableDescriptor baseHtd = new HTableDescriptor(TABLE_NAME);
HColumnDescriptor hcd = new HColumnDescriptor(FAMILY);
@ -95,7 +95,7 @@ public class TestHColumnDescriptorDefaultVersions {
TEST_UTIL.getConfiguration().setInt("hbase.column.max.version", 3);
TEST_UTIL.startMiniCluster(1);
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
// Create a table with one family
HTableDescriptor baseHtd = new HTableDescriptor(TABLE_NAME);
HColumnDescriptor hcd = new HColumnDescriptor(FAMILY);
@ -117,7 +117,7 @@ public class TestHColumnDescriptorDefaultVersions {
TEST_UTIL.getConfiguration().setInt("hbase.column.max.version", 3);
TEST_UTIL.startMiniCluster(1);
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
// Create a table with one family
HTableDescriptor baseHtd = new HTableDescriptor(TABLE_NAME);
HColumnDescriptor hcd = new HColumnDescriptor(FAMILY);
@ -149,7 +149,7 @@ public class TestHColumnDescriptorDefaultVersions {
private void verifyHColumnDescriptor(int expected, final TableName tableName,
final byte[]... families) throws IOException {
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
// Verify descriptor from master
HTableDescriptor htd = admin.getTableDescriptor(tableName);

View File

@ -236,7 +236,7 @@ public class TestMetaTableAccessor {
assertFalse(MetaTableAccessor.tableExists(connection, name));
UTIL.createTable(name, HConstants.CATALOG_FAMILY);
assertTrue(MetaTableAccessor.tableExists(connection, name));
Admin admin = UTIL.getHBaseAdmin();
Admin admin = UTIL.getAdmin();
admin.disableTable(name);
admin.deleteTable(name);
assertFalse(MetaTableAccessor.tableExists(connection, name));

View File

@ -73,7 +73,7 @@ public class TestMultiVersions {
@Before
public void before()
throws MasterNotRunningException, ZooKeeperConnectionException, IOException {
this.admin = UTIL.getHBaseAdmin();
this.admin = UTIL.getAdmin();
}
/**

View File

@ -64,7 +64,7 @@ public class TestNamespace {
public static void setUp() throws Exception {
TEST_UTIL = new HBaseTestingUtility();
TEST_UTIL.startMiniCluster(NUM_SLAVES_BASE);
admin = TEST_UTIL.getHBaseAdmin();
admin = TEST_UTIL.getAdmin();
cluster = TEST_UTIL.getHBaseCluster();
master = ((MiniHBaseCluster)cluster).getMaster();
zkNamespaceManager =

View File

@ -251,7 +251,7 @@ public class TestZooKeeper {
HColumnDescriptor family = new HColumnDescriptor("fam");
desc.addFamily(family);
LOG.info("Creating table " + tableName);
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
try {
admin.createTable(desc);
} finally {
@ -463,7 +463,7 @@ public class TestZooKeeper {
HMaster m = cluster.getMaster();
final ZooKeeperWatcher zkw = m.getZooKeeper();
// now the cluster is up. So assign some regions.
try (Admin admin = TEST_UTIL.getHBaseAdmin()) {
try (Admin admin = TEST_UTIL.getAdmin()) {
byte[][] SPLIT_KEYS = new byte[][] { Bytes.toBytes("a"), Bytes.toBytes("b"),
Bytes.toBytes("c"), Bytes.toBytes("d"), Bytes.toBytes("e"), Bytes.toBytes("f"),
Bytes.toBytes("g"), Bytes.toBytes("h"), Bytes.toBytes("i"), Bytes.toBytes("j") };
@ -527,7 +527,7 @@ public class TestZooKeeper {
cluster.startRegionServer();
HMaster m = cluster.getMaster();
// now the cluster is up. So assign some regions.
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
Table table = null;
try {
byte[][] SPLIT_KEYS = new byte[][] { Bytes.toBytes("1"), Bytes.toBytes("2"),

View File

@ -119,7 +119,7 @@ public class TestHFileArchiving {
TableName.valueOf("testRemovesRegionDirOnArchive");
UTIL.createTable(TABLE_NAME, TEST_FAM);
final Admin admin = UTIL.getHBaseAdmin();
final Admin admin = UTIL.getAdmin();
// get the current store files for the region
List<HRegion> servingRegions = UTIL.getHBaseCluster().getRegions(TABLE_NAME);
@ -250,7 +250,7 @@ public class TestHFileArchiving {
region.waitForFlushesAndCompactions();
// disable table to prevent new updates
UTIL.getHBaseAdmin().disableTable(TABLE_NAME);
UTIL.getAdmin().disableTable(TABLE_NAME);
LOG.debug("Disabled table");
// remove all the files from the archive to get a fair comparison
@ -330,7 +330,7 @@ public class TestHFileArchiving {
region.waitForFlushesAndCompactions();
// disable table to prevent new updates
UTIL.getHBaseAdmin().disableTable(TABLE_NAME);
UTIL.getAdmin().disableTable(TABLE_NAME);
LOG.debug("Disabled table");
// remove all the files from the archive to get a fair comparison
@ -341,7 +341,7 @@ public class TestHFileArchiving {
List<String> storeFiles = region.getStoreFileList(columns);
// then delete the table so the hfiles get archived
UTIL.getHBaseAdmin().deleteColumnFamily(TABLE_NAME, TEST_FAM);
UTIL.getAdmin().deleteColumnFamily(TABLE_NAME, TEST_FAM);
assertArchiveFiles(fs, storeFiles, 30000);

View File

@ -155,11 +155,11 @@ public class TestBlockEvictionFromClient {
exceptionLatch = null;
CustomInnerRegionObserver.throwException.set(false);
// Clean up the tables for every test case
TableName[] listTableNames = TEST_UTIL.getHBaseAdmin().listTableNames();
TableName[] listTableNames = TEST_UTIL.getAdmin().listTableNames();
for (TableName tableName : listTableNames) {
if (!tableName.isSystemTable()) {
TEST_UTIL.getHBaseAdmin().disableTable(tableName);
TEST_UTIL.getHBaseAdmin().deleteTable(tableName);
TEST_UTIL.getAdmin().disableTable(tableName);
TEST_UTIL.getAdmin().deleteTable(tableName);
}
}
}

View File

@ -75,7 +75,7 @@ public class TestClientOperationInterrupt {
util = new HBaseTestingUtility(conf);
util.startMiniCluster();
Admin admin = util.getHBaseAdmin();
Admin admin = util.getAdmin();
if (admin.tableExists(tableName)) {
if (admin.isTableEnabled(tableName)) {
admin.disableTable(tableName);

View File

@ -87,7 +87,7 @@ public class TestCloneSnapshotFromClient {
*/
@Before
public void setup() throws Exception {
this.admin = TEST_UTIL.getHBaseAdmin();
this.admin = TEST_UTIL.getAdmin();
long tid = System.currentTimeMillis();
tableName = TableName.valueOf("testtb-" + tid);

View File

@ -82,7 +82,7 @@ public class TestEnableTable {
final TableName tableName = TableName.valueOf("testEnableTableWithNoRegionServers");
final MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
final HMaster m = cluster.getMaster();
final Admin admin = TEST_UTIL.getHBaseAdmin();
final Admin admin = TEST_UTIL.getAdmin();
final HTableDescriptor desc = new HTableDescriptor(tableName);
desc.addFamily(new HColumnDescriptor(FAMILYNAME));
admin.createTable(desc);
@ -109,10 +109,10 @@ public class TestEnableTable {
cluster.waitForRegionServerToStart(rs2.getRegionServer().getServerName().getHostname(),
rs2.getRegionServer().getServerName().getPort(), 60000);
List<HRegionInfo> regions = TEST_UTIL.getHBaseAdmin().getTableRegions(tableName);
List<HRegionInfo> regions = TEST_UTIL.getAdmin().getTableRegions(tableName);
assertEquals(1, regions.size());
for (HRegionInfo region : regions) {
TEST_UTIL.getHBaseAdmin().assign(region.getEncodedNameAsBytes());
TEST_UTIL.getAdmin().assign(region.getEncodedNameAsBytes());
}
LOG.debug("Waiting for table assigned " + tableName);
TEST_UTIL.waitUntilAllRegionsAssigned(tableName);
@ -143,7 +143,7 @@ public class TestEnableTable {
public void testDeleteForSureClearsAllTableRowsFromMeta()
throws IOException, InterruptedException {
final TableName tableName = TableName.valueOf("testDeleteForSureClearsAllTableRowsFromMeta");
final Admin admin = TEST_UTIL.getHBaseAdmin();
final Admin admin = TEST_UTIL.getAdmin();
final HTableDescriptor desc = new HTableDescriptor(tableName);
desc.addFamily(new HColumnDescriptor(FAMILYNAME));
try {
@ -223,7 +223,7 @@ public class TestEnableTable {
MasterSyncObserver observer = (MasterSyncObserver)testUtil.getHBaseCluster().getMaster()
.getMasterCoprocessorHost().findCoprocessor(MasterSyncObserver.class.getName());
observer.tableCreationLatch = new CountDownLatch(1);
Admin admin = testUtil.getHBaseAdmin();
Admin admin = testUtil.getAdmin();
if (splitKeys != null) {
admin.createTable(htd, splitKeys);
} else {
@ -241,7 +241,7 @@ public class TestEnableTable {
MasterSyncObserver observer = (MasterSyncObserver)testUtil.getHBaseCluster().getMaster()
.getMasterCoprocessorHost().findCoprocessor(MasterSyncObserver.class.getName());
observer.tableDeletionLatch = new CountDownLatch(1);
Admin admin = testUtil.getHBaseAdmin();
Admin admin = testUtil.getAdmin();
try {
admin.disableTable(tableName);
} catch (Exception e) {

View File

@ -105,7 +105,7 @@ public class TestFastFail {
@Ignore ("Can go zombie -- see HBASE-14421; FIX") @Test
public void testFastFail() throws IOException, InterruptedException {
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
final String tableName = "testClientRelearningExperiment";
HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(Bytes
@ -295,7 +295,7 @@ public class TestFastFail {
@Test
public void testCallQueueTooBigExceptionDoesntTriggerPffe() throws Exception {
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
final String tableName = "testCallQueueTooBigException";
HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(Bytes

View File

@ -237,7 +237,7 @@ public class TestFromClientSide {
HTableDescriptor desc = new HTableDescriptor(TABLENAME);
desc.addFamily(hcd);
TEST_UTIL.getHBaseAdmin().createTable(desc);
TEST_UTIL.getAdmin().createTable(desc);
Table h = TEST_UTIL.getConnection().getTable(TABLENAME);
long ts = System.currentTimeMillis();
@ -319,14 +319,14 @@ public class TestFromClientSide {
assertNull(result.getValue(FAMILY, COLUMN));
// major compaction, purged future deletes
TEST_UTIL.getHBaseAdmin().flush(TABLENAME);
TEST_UTIL.getHBaseAdmin().majorCompact(TABLENAME);
TEST_UTIL.getAdmin().flush(TABLENAME);
TEST_UTIL.getAdmin().majorCompact(TABLENAME);
// waiting for the major compaction to complete
TEST_UTIL.waitFor(6000, new Waiter.Predicate<IOException>() {
@Override
public boolean evaluate() throws IOException {
return TEST_UTIL.getHBaseAdmin().getCompactionState(TABLENAME) ==
return TEST_UTIL.getAdmin().getCompactionState(TABLENAME) ==
CompactionState.NONE;
}
});
@ -646,7 +646,7 @@ public class TestFromClientSide {
private List<HRegionLocation> splitTable(final Table t)
throws IOException, InterruptedException {
// Split this table in two.
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
admin.split(t.getName());
admin.close();
List<HRegionLocation> regions = waitOnSplit(t);
@ -1756,7 +1756,7 @@ public class TestFromClientSide {
@Test
public void testDeleteFamilyVersion() throws Exception {
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
TableName TABLE = TableName.valueOf("testDeleteFamilyVersion");
byte [][] QUALIFIERS = makeNAscii(QUALIFIER, 1);
@ -1801,7 +1801,7 @@ public class TestFromClientSide {
byte [][] VALUES = makeN(VALUE, 5);
long [] ts = {1000, 2000, 3000, 4000, 5000};
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
Table ht = TEST_UTIL.createTable(TABLE, FAMILY, 5);
Put put = null;
Result result = null;
@ -3668,7 +3668,7 @@ public class TestFromClientSide {
TableName TABLE = TableName.valueOf("testUpdatesWithMajorCompaction");
Table hTable = TEST_UTIL.createTable(TABLE, FAMILY, 10);
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
// Write a column with values at timestamp 1, 2 and 3
byte[] row = Bytes.toBytes("row2");
@ -3729,7 +3729,7 @@ public class TestFromClientSide {
TableName tableName = TableName.valueOf("testMajorCompactionBetweenTwoUpdates");
Table hTable = TEST_UTIL.createTable(tableName, FAMILY, 10);
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
// Write a column with values at timestamp 1, 2 and 3
byte[] row = Bytes.toBytes("row3");
@ -4094,7 +4094,7 @@ public class TestFromClientSide {
for (int i = 0; i < tables.length; i++) {
TEST_UTIL.createTable(tables[i], FAMILY);
}
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
HTableDescriptor[] ts = admin.listTables();
HashSet<HTableDescriptor> result = new HashSet<HTableDescriptor>(ts.length);
Collections.addAll(result, ts);
@ -4209,7 +4209,7 @@ public class TestFromClientSide {
// to be reloaded.
// Test user metadata
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
// make a modifiable descriptor
HTableDescriptor desc = new HTableDescriptor(a.getTableDescriptor());
// offline the table
@ -5143,7 +5143,7 @@ public class TestFromClientSide {
byte [] family1 = Bytes.toBytes("f1");
byte [] family2 = Bytes.toBytes("f2");
try (Table table = TEST_UTIL.createTable(TABLE, new byte[][] {family1, family2}, 10);
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(TABLE)) {
List<HRegionLocation> allRegionLocations = locator.getAllRegionLocations();
assertEquals(1, allRegionLocations.size());
@ -6159,7 +6159,7 @@ public class TestFromClientSide {
HColumnDescriptor fam = new HColumnDescriptor(FAMILY);
htd.addFamily(fam);
byte[][] KEYS = HBaseTestingUtility.KEYS_FOR_HBA_CREATE_TABLE;
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
admin.createTable(htd, KEYS);
List<HRegionInfo> regions = admin.getTableRegions(htd.getTableName());
@ -6210,7 +6210,7 @@ public class TestFromClientSide {
HColumnDescriptor fam = new HColumnDescriptor(FAMILY);
htd.addFamily(fam);
byte[][] KEYS = HBaseTestingUtility.KEYS_FOR_HBA_CREATE_TABLE;
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
admin.createTable(htd, KEYS);
HRegionLocator locator =
(HRegionLocator) admin.getConnection().getRegionLocator(htd.getTableName());

View File

@ -117,7 +117,7 @@ public class TestFromClientSide3 {
*/
@After
public void tearDown() throws Exception {
for (HTableDescriptor htd: TEST_UTIL.getHBaseAdmin().listTables()) {
for (HTableDescriptor htd: TEST_UTIL.getAdmin().listTables()) {
LOG.info("Tear down, remove table=" + htd.getTableName());
TEST_UTIL.deleteTable(htd.getTableName());
}
@ -171,7 +171,7 @@ public class TestFromClientSide3 {
TableName tableName = TableName.valueOf("testAdvancedConfigOverride");
Table hTable = TEST_UTIL.createTable(tableName, FAMILY, 10);
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
ClusterConnection connection = (ClusterConnection) TEST_UTIL.getConnection();
// Create 3 store files.
@ -471,7 +471,7 @@ public class TestFromClientSide3 {
@Test
public void testGetEmptyRow() throws Exception {
//Create a table and put in 1 row
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(Bytes.toBytes("test")));
desc.addFamily(new HColumnDescriptor(FAMILY));
admin.createTable(desc);
@ -713,7 +713,7 @@ public class TestFromClientSide3 {
HTableDescriptor htd = new HTableDescriptor(tableName);
HColumnDescriptor fam = new HColumnDescriptor(FAMILY);
htd.addFamily(fam);
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
admin.createTable(htd);
Table table = admin.getConnection().getTable(TableName.valueOf("testMVCCUsingMVCCPreAssign"));
//put two row first to init the scanner

View File

@ -340,7 +340,7 @@ public class TestHCM {
final ConnectionImplementation hci = (ConnectionImplementation)TEST_UTIL.getConnection();
try (RegionLocator l = TEST_UTIL.getConnection().getRegionLocator(tn)) {
while (l.getRegionLocation(rk).getPort() != sn.getPort()) {
TEST_UTIL.getHBaseAdmin().move(l.getRegionLocation(rk).getRegionInfo().
TEST_UTIL.getAdmin().move(l.getRegionLocation(rk).getRegionInfo().
getEncodedNameAsBytes(), Bytes.toBytes(sn.toString()));
TEST_UTIL.waitUntilNoRegionsInTransition();
hci.clearRegionCache(tn);
@ -804,7 +804,7 @@ public class TestHCM {
table.close();
connection.close();
Assert.assertTrue("Unexpected exception is " + failed.get(), failed.get() == null);
TEST_UTIL.getHBaseAdmin().setBalancerRunning(previousBalance, true);
TEST_UTIL.getAdmin().setBalancerRunning(previousBalance, true);
}
/**
@ -815,7 +815,7 @@ public class TestHCM {
TableName tableName = TableName.valueOf("HCM-testConnectionIdle");
TEST_UTIL.createTable(tableName, FAM_NAM).close();
int idleTime = 20000;
boolean previousBalance = TEST_UTIL.getHBaseAdmin().setBalancerRunning(false, true);
boolean previousBalance = TEST_UTIL.getAdmin().setBalancerRunning(false, true);
Configuration c2 = new Configuration(TEST_UTIL.getConfiguration());
// We want to work on a separate connection.
@ -863,7 +863,7 @@ public class TestHCM {
connection.close();
EnvironmentEdgeManager.reset();
TEST_UTIL.getHBaseAdmin().setBalancerRunning(previousBalance, true);
TEST_UTIL.getAdmin().setBalancerRunning(previousBalance, true);
}
/**
@ -877,7 +877,7 @@ public class TestHCM {
TableName tableName = TableName.valueOf("HCM-testConnectionCut");
TEST_UTIL.createTable(tableName, FAM_NAM).close();
boolean previousBalance = TEST_UTIL.getHBaseAdmin().setBalancerRunning(false, true);
boolean previousBalance = TEST_UTIL.getAdmin().setBalancerRunning(false, true);
Configuration c2 = new Configuration(TEST_UTIL.getConfiguration());
// We want to work on a separate connection.
@ -932,7 +932,7 @@ public class TestHCM {
} finally {
syncBlockingFilter.set(true);
t.join();
TEST_UTIL.getHBaseAdmin().setBalancerRunning(previousBalance, true);
TEST_UTIL.getAdmin().setBalancerRunning(previousBalance, true);
}
table.close();
@ -1008,7 +1008,7 @@ public class TestHCM {
assertNotNull(conn.getCachedLocation(TABLE_NAME, ROW));
assertNotNull(conn.getCachedLocation(TableName.valueOf(TABLE_NAME.getName()), ROW.clone()));
TEST_UTIL.getHBaseAdmin().setBalancerRunning(false, false);
TEST_UTIL.getAdmin().setBalancerRunning(false, false);
HMaster master = TEST_UTIL.getMiniHBaseCluster().getMaster();
// We can wait for all regions to be online, that makes log reading easier when debugging
@ -1040,7 +1040,7 @@ public class TestHCM {
// Moving. It's possible that we don't have all the regions online at this point, so
// the test must depends only on the region we're looking at.
LOG.info("Move starting region="+toMove.getRegionInfo().getRegionNameAsString());
TEST_UTIL.getHBaseAdmin().move(
TEST_UTIL.getAdmin().move(
toMove.getRegionInfo().getEncodedNameAsBytes(),
destServerName.getServerName().getBytes()
);
@ -1099,7 +1099,7 @@ public class TestHCM {
// We move it back to do another test with a scan
LOG.info("Move starting region=" + toMove.getRegionInfo().getRegionNameAsString());
TEST_UTIL.getHBaseAdmin().move(
TEST_UTIL.getAdmin().move(
toMove.getRegionInfo().getEncodedNameAsBytes(),
curServer.getServerName().getServerName().getBytes()
);
@ -1304,7 +1304,7 @@ public class TestHCM {
conn.clearRegionCache(TABLE_NAME3);
Assert.assertEquals(0, conn.getNumberOfCachedRegionLocations(TABLE_NAME3));
TEST_UTIL.getHBaseAdmin().setBalancerRunning(false, false);
TEST_UTIL.getAdmin().setBalancerRunning(false, false);
HMaster master = TEST_UTIL.getMiniHBaseCluster().getMaster();
// We can wait for all regions to be online, that makes log reading easier when debugging
@ -1357,7 +1357,7 @@ public class TestHCM {
// Moving. It's possible that we don't have all the regions online at this point, so
// the test must depends only on the region we're looking at.
LOG.info("Move starting region="+toMove.getRegionInfo().getRegionNameAsString());
TEST_UTIL.getHBaseAdmin().move(
TEST_UTIL.getAdmin().move(
toMove.getRegionInfo().getEncodedNameAsBytes(),
destServerName.getServerName().getBytes()
);

View File

@ -162,7 +162,7 @@ public class TestHTableMultiplexerFlushCache {
// Move the region
LOG.info("Moving " + loc.getRegionInfo().getEncodedName() + " from " + originalServer
+ " to " + newServer);
TEST_UTIL.getHBaseAdmin().move(loc.getRegionInfo().getEncodedNameAsBytes(),
TEST_UTIL.getAdmin().move(loc.getRegionInfo().getEncodedNameAsBytes(),
Bytes.toBytes(newServer.getServerName()));
TEST_UTIL.waitUntilAllRegionsAssigned(TABLE);

View File

@ -177,14 +177,14 @@ public class TestIllegalTableDescriptor {
}
private void checkTableIsLegal(HTableDescriptor htd) throws IOException {
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
admin.createTable(htd);
assertTrue(admin.tableExists(htd.getTableName()));
TEST_UTIL.deleteTable(htd.getTableName());
}
private void checkTableIsIllegal(HTableDescriptor htd) throws IOException {
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
try {
admin.createTable(htd);
fail();

View File

@ -87,7 +87,7 @@ public class TestLeaseRenewal {
*/
@After
public void tearDown() throws Exception {
for (HTableDescriptor htd : TEST_UTIL.getHBaseAdmin().listTables()) {
for (HTableDescriptor htd : TEST_UTIL.getAdmin().listTables()) {
LOG.info("Tear down, remove table=" + htd.getTableName());
TEST_UTIL.deleteTable(htd.getTableName());
}

View File

@ -112,7 +112,7 @@ public class TestMetaWithReplicas {
@Test
public void testMetaHTDReplicaCount() throws Exception {
assertTrue(TEST_UTIL.getHBaseAdmin().getTableDescriptor(TableName.META_TABLE_NAME)
assertTrue(TEST_UTIL.getAdmin().getTableDescriptor(TableName.META_TABLE_NAME)
.getRegionReplication() == 3);
}
@ -166,14 +166,14 @@ public class TestMetaWithReplicas {
TableName TABLE = TableName.valueOf("testShutdownHandling");
byte[][] FAMILIES = new byte[][] { Bytes.toBytes("foo") };
if (util.getHBaseAdmin().tableExists(TABLE)) {
util.getHBaseAdmin().disableTable(TABLE);
util.getHBaseAdmin().deleteTable(TABLE);
if (util.getAdmin().tableExists(TABLE)) {
util.getAdmin().disableTable(TABLE);
util.getAdmin().deleteTable(TABLE);
}
ServerName master = null;
try (Connection c = ConnectionFactory.createConnection(util.getConfiguration());) {
try (Table htable = util.createTable(TABLE, FAMILIES);) {
util.getHBaseAdmin().flush(TableName.META_TABLE_NAME);
util.getAdmin().flush(TableName.META_TABLE_NAME);
Thread.sleep(conf.getInt(StorefileRefresherChore.REGIONSERVER_STOREFILE_REFRESH_PERIOD,
30000) * 6);
List<HRegionInfo> regions = MetaTableAccessor.getTableRegions(c, TABLE);
@ -184,13 +184,13 @@ public class TestMetaWithReplicas {
// If the servers are the same, then move the test table's region out of the server
// to another random server
if (hrl.getServerName().equals(primary)) {
util.getHBaseAdmin().move(hrl.getRegionInfo().getEncodedNameAsBytes(), null);
util.getAdmin().move(hrl.getRegionInfo().getEncodedNameAsBytes(), null);
// wait for the move to complete
do {
Thread.sleep(10);
hrl = MetaTableAccessor.getRegionLocation(c, regions.get(0));
} while (primary.equals(hrl.getServerName()));
util.getHBaseAdmin().flush(TableName.META_TABLE_NAME);
util.getAdmin().flush(TableName.META_TABLE_NAME);
Thread.sleep(conf.getInt(StorefileRefresherChore.REGIONSERVER_STOREFILE_REFRESH_PERIOD,
30000) * 3);
}
@ -237,9 +237,9 @@ public class TestMetaWithReplicas {
public void testMetaLookupThreadPoolCreated() throws Exception {
TableName TABLE = TableName.valueOf("testMetaLookupThreadPoolCreated");
byte[][] FAMILIES = new byte[][] { Bytes.toBytes("foo") };
if (TEST_UTIL.getHBaseAdmin().tableExists(TABLE)) {
TEST_UTIL.getHBaseAdmin().disableTable(TABLE);
TEST_UTIL.getHBaseAdmin().deleteTable(TABLE);
if (TEST_UTIL.getAdmin().tableExists(TABLE)) {
TEST_UTIL.getAdmin().disableTable(TABLE);
TEST_UTIL.getAdmin().deleteTable(TABLE);
}
try (Table htable = TEST_UTIL.createTable(TABLE, FAMILIES);) {
byte[] row = "test".getBytes();
@ -392,7 +392,7 @@ public class TestMetaWithReplicas {
// check that the data in the znode is parseable (this would also mean the znode exists)
byte[] data = ZKUtil.getData(zkw, primaryMetaZnode);
ServerName currentServer = ProtobufUtil.toServerName(data);
Collection<ServerName> liveServers = TEST_UTIL.getHBaseAdmin().getClusterStatus().getServers();
Collection<ServerName> liveServers = TEST_UTIL.getAdmin().getClusterStatus().getServers();
ServerName moveToServer = null;
for (ServerName s : liveServers) {
if (!currentServer.equals(s)) {
@ -402,8 +402,8 @@ public class TestMetaWithReplicas {
assert(moveToServer != null);
TableName tableName = TableName.valueOf("randomTable5678");
TEST_UTIL.createTable(tableName, "f");
assertTrue(TEST_UTIL.getHBaseAdmin().tableExists(tableName));
TEST_UTIL.getHBaseAdmin().move(HRegionInfo.FIRST_META_REGIONINFO.getEncodedNameAsBytes(),
assertTrue(TEST_UTIL.getAdmin().tableExists(tableName));
TEST_UTIL.getAdmin().move(HRegionInfo.FIRST_META_REGIONINFO.getEncodedNameAsBytes(),
Bytes.toBytes(moveToServer.getServerName()));
int i = 0;
do {
@ -413,8 +413,8 @@ public class TestMetaWithReplicas {
i++;
} while (!moveToServer.equals(currentServer) && i < 1000); //wait for 10 seconds overall
assert(i != 1000);
TEST_UTIL.getHBaseAdmin().disableTable(tableName);
assertTrue(TEST_UTIL.getHBaseAdmin().isTableDisabled(tableName));
TEST_UTIL.getAdmin().disableTable(tableName);
assertTrue(TEST_UTIL.getAdmin().isTableDisabled(tableName));
}
@Test
@ -449,7 +449,7 @@ public class TestMetaWithReplicas {
TEST_UTIL.getMiniHBaseCluster().getMaster().getAssignmentManager()
.getRegionStates().createRegionState(h);
TEST_UTIL.assignRegion(h);
HBaseFsckRepair.waitUntilAssigned(TEST_UTIL.getHBaseAdmin(), h);
HBaseFsckRepair.waitUntilAssigned(TEST_UTIL.getAdmin(), h);
// check that problem exists
HBaseFsck hbck = doFsck(TEST_UTIL.getConfiguration(), false);
assertErrors(hbck, new ERROR_CODE[]{ERROR_CODE.UNKNOWN, ERROR_CODE.SHOULD_NOT_BE_DEPLOYED});

View File

@ -161,9 +161,9 @@ public class TestMobCloneSnapshotFromClient extends TestCloneSnapshotFromClient
hcd.setMobThreshold(0L);
htd.addFamily(hcd);
}
util.getHBaseAdmin().createTable(htd, splitKeys);
util.getAdmin().createTable(htd, splitKeys);
SnapshotTestingUtils.waitForTableToBeOnline(util, tableName);
assertEquals((splitKeys.length + 1) * regionReplication,
util.getHBaseAdmin().getTableRegions(tableName).size());
util.getAdmin().getTableRegions(tableName).size());
}
}

View File

@ -117,7 +117,7 @@ public class TestMultiRespectsLimits {
HColumnDescriptor hcd = new HColumnDescriptor(FAMILY);
hcd.setDataBlockEncoding(DataBlockEncoding.FAST_DIFF);
desc.addFamily(hcd);
TEST_UTIL.getHBaseAdmin().createTable(desc);
TEST_UTIL.getAdmin().createTable(desc);
Table t = TEST_UTIL.getConnection().getTable(name);
final HRegionServer regionServer = TEST_UTIL.getHBaseCluster().getRegionServer(0);

View File

@ -217,7 +217,7 @@ public class TestReplicaWithCluster {
SlowMeCopro.sleepTime.set(0);
}
HTU.getHBaseAdmin().disableTable(hdt.getTableName());
HTU.getAdmin().disableTable(hdt.getTableName());
HTU.deleteTable(hdt.getTableName());
}
@ -238,13 +238,13 @@ public class TestReplicaWithCluster {
Assert.assertFalse(r.isStale());
// Add a CF, it should work.
HTableDescriptor bHdt = HTU.getHBaseAdmin().getTableDescriptor(hdt.getTableName());
HTableDescriptor bHdt = HTU.getAdmin().getTableDescriptor(hdt.getTableName());
HColumnDescriptor hcd = new HColumnDescriptor(row);
hdt.addFamily(hcd);
HTU.getHBaseAdmin().disableTable(hdt.getTableName());
HTU.getHBaseAdmin().modifyTable(hdt.getTableName(), hdt);
HTU.getHBaseAdmin().enableTable(hdt.getTableName());
HTableDescriptor nHdt = HTU.getHBaseAdmin().getTableDescriptor(hdt.getTableName());
HTU.getAdmin().disableTable(hdt.getTableName());
HTU.getAdmin().modifyTable(hdt.getTableName(), hdt);
HTU.getAdmin().enableTable(hdt.getTableName());
HTableDescriptor nHdt = HTU.getAdmin().getTableDescriptor(hdt.getTableName());
Assert.assertEquals("fams=" + Arrays.toString(nHdt.getColumnFamilies()),
bHdt.getColumnFamilyCount() + 1, nHdt.getColumnFamilyCount());
@ -267,7 +267,7 @@ public class TestReplicaWithCluster {
SlowMeCopro.sleepTime.set(0);
}
Admin admin = HTU.getHBaseAdmin();
Admin admin = HTU.getAdmin();
nHdt =admin.getTableDescriptor(hdt.getTableName());
Assert.assertEquals("fams=" + Arrays.toString(nHdt.getColumnFamilies()),
bHdt.getColumnFamilyCount() + 1, nHdt.getColumnFamilyCount());
@ -288,7 +288,7 @@ public class TestReplicaWithCluster {
hdt.addFamily(fam);
hdt.addCoprocessor(SlowMeCopro.class.getName());
HTU.getHBaseAdmin().createTable(hdt, HBaseTestingUtility.KEYS_FOR_HBA_CREATE_TABLE);
HTU.getAdmin().createTable(hdt, HBaseTestingUtility.KEYS_FOR_HBA_CREATE_TABLE);
Configuration conf2 = HBaseConfiguration.create(HTU.getConfiguration());
conf2.set(HConstants.HBASE_CLIENT_INSTANCE_ID, String.valueOf(-1));
@ -299,7 +299,7 @@ public class TestReplicaWithCluster {
HTU2.setZkCluster(miniZK);
HTU2.startMiniCluster(NB_SERVERS);
LOG.info("Setup second Zk");
HTU2.getHBaseAdmin().createTable(hdt, HBaseTestingUtility.KEYS_FOR_HBA_CREATE_TABLE);
HTU2.getAdmin().createTable(hdt, HBaseTestingUtility.KEYS_FOR_HBA_CREATE_TABLE);
ReplicationAdmin admin = new ReplicationAdmin(HTU.getConfiguration());
@ -313,7 +313,7 @@ public class TestReplicaWithCluster {
final Table table = HTU.getConnection().getTable(hdt.getTableName());
table.put(p);
HTU.getHBaseAdmin().flush(table.getName());
HTU.getAdmin().flush(table.getName());
LOG.info("Put & flush done on the first cluster. Now doing a get on the same cluster.");
Waiter.waitFor(HTU.getConfiguration(), 1000, new Waiter.Predicate<Exception>() {
@ -352,10 +352,10 @@ public class TestReplicaWithCluster {
});
table2.close();
HTU.getHBaseAdmin().disableTable(hdt.getTableName());
HTU.getAdmin().disableTable(hdt.getTableName());
HTU.deleteTable(hdt.getTableName());
HTU2.getHBaseAdmin().disableTable(hdt.getTableName());
HTU2.getAdmin().disableTable(hdt.getTableName());
HTU2.deleteTable(hdt.getTableName());
// We shutdown HTU2 minicluster later, in afterClass(), as shutting down
@ -438,7 +438,7 @@ public class TestReplicaWithCluster {
SlowMeCopro.sleepTime.set(0);
}
HTU.getHBaseAdmin().disableTable(hdt.getTableName());
HTU.getAdmin().disableTable(hdt.getTableName());
HTU.deleteTable(hdt.getTableName());
}
@ -471,7 +471,7 @@ public class TestReplicaWithCluster {
Result r = table.get(g);
Assert.assertTrue(r.isStale());
} finally {
HTU.getHBaseAdmin().disableTable(hdt.getTableName());
HTU.getAdmin().disableTable(hdt.getTableName());
HTU.deleteTable(hdt.getTableName());
}
}
@ -516,7 +516,7 @@ public class TestReplicaWithCluster {
Assert.assertTrue(r.isStale());
} finally {
HTU.getHBaseAdmin().disableTable(hdt.getTableName());
HTU.getAdmin().disableTable(hdt.getTableName());
HTU.deleteTable(hdt.getTableName());
}
}

View File

@ -303,7 +303,7 @@ public class TestReplicasClient {
public void testLocations() throws Exception {
byte[] b1 = "testLocations".getBytes();
openRegion(hriSecondary);
ClusterConnection hc = (ClusterConnection) HTU.getHBaseAdmin().getConnection();
ClusterConnection hc = (ClusterConnection) HTU.getAdmin().getConnection();
try {
hc.clearRegionCache();

View File

@ -103,7 +103,7 @@ public class TestRestoreSnapshotFromClient {
*/
@Before
public void setup() throws Exception {
this.admin = TEST_UTIL.getHBaseAdmin();
this.admin = TEST_UTIL.getAdmin();
long tid = System.currentTimeMillis();
tableName =
@ -146,7 +146,7 @@ public class TestRestoreSnapshotFromClient {
@After
public void tearDown() throws Exception {
TEST_UTIL.deleteTable(tableName);
SnapshotTestingUtils.deleteAllSnapshots(TEST_UTIL.getHBaseAdmin());
SnapshotTestingUtils.deleteAllSnapshots(TEST_UTIL.getAdmin());
SnapshotTestingUtils.deleteArchiveDirectory(TEST_UTIL);
}

View File

@ -137,7 +137,7 @@ public class TestScannerTimeout {
Scan scan = new Scan();
scan.setCaching(SCANNER_CACHING);
LOG.info("************ TEST3686A");
MetaTableAccessor.fullScanMetaAndPrint(TEST_UTIL.getHBaseAdmin().getConnection());
MetaTableAccessor.fullScanMetaAndPrint(TEST_UTIL.getAdmin().getConnection());
// Set a very high timeout, we want to test what happens when a RS
// fails but the region is recovered before the lease times out.
// Since the RS is already created, this conf is client-side only for

View File

@ -77,7 +77,7 @@ public class TestSizeFailures {
splits[i - 1][0] = (byte) (split >>> 8);
splits[i - 1][0] = (byte) (split);
}
TEST_UTIL.getHBaseAdmin().createTable(desc, splits);
TEST_UTIL.getAdmin().createTable(desc, splits);
Connection conn = TEST_UTIL.getConnection();
try (Table table = conn.getTable(TABLENAME)) {

View File

@ -121,7 +121,7 @@ public class TestSnapshotCloneIndependence {
fs = UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getFileSystem();
rootDir = UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getRootDir();
admin = UTIL.getHBaseAdmin();
admin = UTIL.getAdmin();
originalTableName = TableName.valueOf("test" + testName.getMethodName());
cloneTableName = TableName.valueOf("test-clone-" + originalTableName);
snapshotNameAsString = "snapshot_" + originalTableName;
@ -137,7 +137,7 @@ public class TestSnapshotCloneIndependence {
public void tearDown() throws Exception {
UTIL.deleteTable(originalTableName);
UTIL.deleteTable(cloneTableName);
SnapshotTestingUtils.deleteAllSnapshots(UTIL.getHBaseAdmin());
SnapshotTestingUtils.deleteAllSnapshots(UTIL.getAdmin());
SnapshotTestingUtils.deleteArchiveDirectory(UTIL);
}

View File

@ -116,7 +116,7 @@ public class TestSnapshotFromClient {
@After
public void tearDown() throws Exception {
UTIL.deleteTable(TABLE_NAME);
SnapshotTestingUtils.deleteAllSnapshots(UTIL.getHBaseAdmin());
SnapshotTestingUtils.deleteAllSnapshots(UTIL.getAdmin());
SnapshotTestingUtils.deleteArchiveDirectory(UTIL);
}
@ -135,7 +135,7 @@ public class TestSnapshotFromClient {
*/
@Test (timeout=300000)
public void testMetaTablesSnapshot() throws Exception {
Admin admin = UTIL.getHBaseAdmin();
Admin admin = UTIL.getAdmin();
byte[] snapshotName = Bytes.toBytes("metaSnapshot");
try {
@ -153,7 +153,7 @@ public class TestSnapshotFromClient {
*/
@Test (timeout=300000)
public void testSnapshotDeletionWithRegex() throws Exception {
Admin admin = UTIL.getHBaseAdmin();
Admin admin = UTIL.getAdmin();
// make sure we don't fail on listing snapshots
SnapshotTestingUtils.assertNoSnapshots(admin);
@ -189,7 +189,7 @@ public class TestSnapshotFromClient {
*/
@Test (timeout=300000)
public void testOfflineTableSnapshot() throws Exception {
Admin admin = UTIL.getHBaseAdmin();
Admin admin = UTIL.getAdmin();
// make sure we don't fail on listing snapshots
SnapshotTestingUtils.assertNoSnapshots(admin);
@ -237,7 +237,7 @@ public class TestSnapshotFromClient {
@Test (timeout=300000)
public void testSnapshotFailsOnNonExistantTable() throws Exception {
Admin admin = UTIL.getHBaseAdmin();
Admin admin = UTIL.getAdmin();
// make sure we don't fail on listing snapshots
SnapshotTestingUtils.assertNoSnapshots(admin);
String tableName = "_not_a_table";
@ -268,7 +268,7 @@ public class TestSnapshotFromClient {
public void testOfflineTableSnapshotWithEmptyRegions() throws Exception {
// test with an empty table with one region
Admin admin = UTIL.getHBaseAdmin();
Admin admin = UTIL.getAdmin();
// make sure we don't fail on listing snapshots
SnapshotTestingUtils.assertNoSnapshots(admin);
@ -313,7 +313,7 @@ public class TestSnapshotFromClient {
Admin admin = null;
TableName tableName2 = TableName.valueOf("testListTableSnapshots");
try {
admin = UTIL.getHBaseAdmin();
admin = UTIL.getAdmin();
HTableDescriptor htd = new HTableDescriptor(tableName2);
UTIL.createTable(htd, new byte[][] { TEST_FAM }, UTIL.getConfiguration());
@ -357,7 +357,7 @@ public class TestSnapshotFromClient {
public void testListTableSnapshotsWithRegex() throws Exception {
Admin admin = null;
try {
admin = UTIL.getHBaseAdmin();
admin = UTIL.getAdmin();
String table1Snapshot1 = "Table1Snapshot1";
admin.snapshot(table1Snapshot1, TABLE_NAME);
@ -397,7 +397,7 @@ public class TestSnapshotFromClient {
Admin admin = null;
TableName tableName2 = TableName.valueOf("testListTableSnapshots");
try {
admin = UTIL.getHBaseAdmin();
admin = UTIL.getAdmin();
HTableDescriptor htd = new HTableDescriptor(tableName2);
UTIL.createTable(htd, new byte[][] { TEST_FAM }, UTIL.getConfiguration());
@ -430,7 +430,7 @@ public class TestSnapshotFromClient {
public void testDeleteTableSnapshotsWithRegex() throws Exception {
Admin admin = null;
try {
admin = UTIL.getHBaseAdmin();
admin = UTIL.getAdmin();
String table1Snapshot1 = "Table1Snapshot1";
admin.snapshot(table1Snapshot1, TABLE_NAME);

View File

@ -133,7 +133,7 @@ public class TestSnapshotMetadata {
@Before
public void setup() throws Exception {
admin = UTIL.getHBaseAdmin();
admin = UTIL.getAdmin();
createTableWithNonDefaultProperties();
}

View File

@ -89,7 +89,7 @@ public class TestTableSnapshotScanner {
} else {
util.createTable(tableName, FAMILIES);
}
Admin admin = util.getHBaseAdmin();
Admin admin = util.getAdmin();
// put some stuff in the table
Table table = util.getConnection().getTable(tableName);
@ -146,7 +146,7 @@ public class TestTableSnapshotScanner {
scanner.close();
} finally {
if (!shutdownCluster) {
util.getHBaseAdmin().deleteSnapshot(snapshotName);
util.getAdmin().deleteSnapshot(snapshotName);
util.deleteTable(tableName);
tearDownCluster();
}

View File

@ -80,7 +80,7 @@ public class TestConstraint {
// add a constraint
Constraints.add(desc, CheckWasRunConstraint.class);
util.getHBaseAdmin().createTable(desc);
util.getAdmin().createTable(desc);
Table table = util.getConnection().getTable(tableName);
try {
// test that we don't fail on a valid put
@ -113,7 +113,7 @@ public class TestConstraint {
// add a constraint that is sure to fail
Constraints.add(desc, AllFailConstraint.class);
util.getHBaseAdmin().createTable(desc);
util.getAdmin().createTable(desc);
Table table = util.getConnection().getTable(tableName);
// test that we do fail on violation
@ -157,7 +157,7 @@ public class TestConstraint {
// and then disable the failing constraint
Constraints.disableConstraint(desc, AllFailConstraint.class);
util.getHBaseAdmin().createTable(desc);
util.getAdmin().createTable(desc);
Table table = util.getConnection().getTable(tableName);
try {
// test that we don't fail because its disabled
@ -190,7 +190,7 @@ public class TestConstraint {
// then disable all the constraints
Constraints.disable(desc);
util.getHBaseAdmin().createTable(desc);
util.getAdmin().createTable(desc);
Table table = util.getConnection().getTable(tableName);
try {
// test that we do fail on violation
@ -223,7 +223,7 @@ public class TestConstraint {
Constraints.add(desc, CheckWasRunConstraint.class);
CheckWasRunConstraint.wasRun = false;
util.getHBaseAdmin().createTable(desc);
util.getAdmin().createTable(desc);
Table table = util.getConnection().getTable(tableName);
// test that we do fail on violation
@ -248,8 +248,8 @@ public class TestConstraint {
public void cleanup() throws Exception {
// cleanup
CheckWasRunConstraint.wasRun = false;
util.getHBaseAdmin().disableTable(tableName);
util.getHBaseAdmin().deleteTable(tableName);
util.getAdmin().disableTable(tableName);
util.getAdmin().deleteTable(tableName);
}
@AfterClass

View File

@ -86,7 +86,7 @@ public class TestMasterCoprocessorExceptionWithAbort {
HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(TEST_TABLE));
htd.addFamily(new HColumnDescriptor(TEST_FAMILY));
try {
Admin admin = UTIL.getHBaseAdmin();
Admin admin = UTIL.getAdmin();
admin.createTable(htd);
fail("BuggyMasterObserver failed to throw an exception.");
} catch (IOException e) {

View File

@ -192,7 +192,7 @@ public class TestMasterCoprocessorExceptionWithRemove {
boolean threwDNRE = false;
try {
Admin admin = UTIL.getHBaseAdmin();
Admin admin = UTIL.getAdmin();
admin.createTable(htd1);
} catch (IOException e) {
if (e.getClass().getName().equals("org.apache.hadoop.hbase.DoNotRetryIOException")) {
@ -219,7 +219,7 @@ public class TestMasterCoprocessorExceptionWithRemove {
// by creating another table: should not have a problem this time.
HTableDescriptor htd2 = new HTableDescriptor(TableName.valueOf(TEST_TABLE2));
htd2.addFamily(new HColumnDescriptor(TEST_FAMILY2));
Admin admin = UTIL.getHBaseAdmin();
Admin admin = UTIL.getAdmin();
try {
admin.createTable(htd2);
} catch (IOException e) {

View File

@ -1844,7 +1844,7 @@ public class TestMasterObserver {
// create a table
HTableDescriptor htd = new HTableDescriptor(tableName);
htd.addFamily(new HColumnDescriptor(TEST_FAMILY));
Admin admin = UTIL.getHBaseAdmin();
Admin admin = UTIL.getAdmin();
tableCreationLatch = new CountDownLatch(1);
admin.createTable(htd);
@ -1907,7 +1907,7 @@ public class TestMasterObserver {
// create a table
Admin admin = UTIL.getHBaseAdmin();
Admin admin = UTIL.getAdmin();
admin.createNamespace(NamespaceDescriptor.create(testNamespace).build());
assertTrue("Test namespace should be created", cp.wasCreateNamespaceCalled());
@ -2082,7 +2082,7 @@ public class TestMasterObserver {
assertTrue("Coprocessor should be called on region rebalancing",
cp.wasBalanceCalled());
} finally {
Admin admin = UTIL.getHBaseAdmin();
Admin admin = UTIL.getAdmin();
admin.disableTable(tableName);
deleteTable(admin, tableName);
}

View File

@ -122,11 +122,11 @@ public class TestOpenTableInCoprocessor {
@After
public void cleanupTestTable() throws Exception {
UTIL.getHBaseAdmin().disableTable(primaryTable);
UTIL.getHBaseAdmin().deleteTable(primaryTable);
UTIL.getAdmin().disableTable(primaryTable);
UTIL.getAdmin().deleteTable(primaryTable);
UTIL.getHBaseAdmin().disableTable(otherTable);
UTIL.getHBaseAdmin().deleteTable(otherTable);
UTIL.getAdmin().disableTable(otherTable);
UTIL.getAdmin().deleteTable(otherTable);
}
@ -156,7 +156,7 @@ public class TestOpenTableInCoprocessor {
other.addFamily(new HColumnDescriptor(family));
Admin admin = UTIL.getHBaseAdmin();
Admin admin = UTIL.getAdmin();
admin.createTable(primary);
admin.createTable(other);

View File

@ -76,7 +76,7 @@ public class TestRegionObserverBypass {
@Before
public void setUp() throws Exception {
Admin admin = util.getHBaseAdmin();
Admin admin = util.getAdmin();
if (admin.tableExists(tableName)) {
if (admin.isTableEnabled(tableName)) {
admin.disableTable(tableName);

View File

@ -270,7 +270,7 @@ public class TestRegionObserverScannerOpenHook {
desc.addCoprocessor(NoDataFromCompaction.class.getName(), null, Coprocessor.PRIORITY_HIGHEST,
null);
Admin admin = UTIL.getHBaseAdmin();
Admin admin = UTIL.getAdmin();
admin.createTable(desc);
Table table = UTIL.getConnection().getTable(desc.getTableName());

View File

@ -100,7 +100,7 @@ public class FilterTestingCluster {
conf = HBaseConfiguration.create(conf);
conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 1);
try {
admin = TEST_UTIL.getHBaseAdmin();
admin = TEST_UTIL.getAdmin();
} catch (MasterNotRunningException e) {
assertNull("Master is not running", e);
} catch (ZooKeeperConnectionException e) {

View File

@ -176,7 +176,7 @@ public class TestFilterWrapper {
TestFilterWrapper.conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 1);
try {
connection = ConnectionFactory.createConnection(TestFilterWrapper.conf);
admin = TEST_UTIL.getHBaseAdmin();
admin = TEST_UTIL.getAdmin();
} catch (MasterNotRunningException e) {
assertNull("Master is not running", e);
} catch (ZooKeeperConnectionException e) {

View File

@ -298,7 +298,7 @@ public class TestBlockReorder {
((HRegion)region).getWAL().registerWALActionsListener(listener);
}
htu.getHBaseAdmin().rollWALWriter(targetRs.getServerName());
htu.getAdmin().rollWALWriter(targetRs.getServerName());
// wait
try {

View File

@ -218,7 +218,7 @@ public class TestChangingEncoding {
private void compactAndWait() throws IOException, InterruptedException {
LOG.debug("Compacting table " + tableName);
HRegionServer rs = TEST_UTIL.getMiniHBaseCluster().getRegionServer(0);
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
admin.majorCompact(tableName);
// Waiting for the compaction to start, at least .5s.

View File

@ -67,7 +67,7 @@ public class TestLoadAndSwitchEncodeOnDisk extends
@Test(timeout=TIMEOUT_MS)
public void loadTest() throws Exception {
Admin admin = TEST_UTIL.getHBaseAdmin();
Admin admin = TEST_UTIL.getAdmin();
compression = Compression.Algorithm.GZ; // used for table setup
super.loadTest();

View File

@ -120,7 +120,7 @@ public class TestTableSnapshotInputFormat extends TableSnapshotInputFormatTestBa
"Snapshot job should not use BucketCache.",
0, job.getFloat("hbase.bucketcache.size", -1), 0.01);
} finally {
UTIL.getHBaseAdmin().deleteSnapshot(snapshotName);
UTIL.getAdmin().deleteSnapshot(snapshotName);
UTIL.deleteTable(tableName);
tearDownCluster();
}
@ -177,7 +177,7 @@ public class TestTableSnapshotInputFormat extends TableSnapshotInputFormatTestBa
verifyWithMockedMapReduce(job, numRegions, expectedNumSplits, getStartRow(), getEndRow());
} finally {
util.getHBaseAdmin().deleteSnapshot(snapshotName);
util.getAdmin().deleteSnapshot(snapshotName);
util.deleteTable(tableName);
tearDownCluster();
}
@ -258,7 +258,7 @@ public class TestTableSnapshotInputFormat extends TableSnapshotInputFormatTestBa
Assert.assertTrue(job.isSuccessful());
} finally {
if (!shutdownCluster) {
util.getHBaseAdmin().deleteSnapshot(snapshotName);
util.getAdmin().deleteSnapshot(snapshotName);
util.deleteTable(tableName);
}
}

Some files were not shown because too many files have changed in this diff Show More