@Override public void run() { try { UTIL2.getAdmin().transitReplicationPeerSyncReplicationState(PEER_ID, SyncReplicationState.DOWNGRADE_ACTIVE); } catch (IOException e) { throw new UncheckedIOException(e); } } };
@Before public void beforeMethod() throws Exception { Admin admin = TEST_UTIL.getAdmin(); if (admin.tableExists(TABLE_NAME)) { TEST_UTIL.deleteTable(TABLE_NAME); } HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(TABLE)); htd.addFamily(new HColumnDescriptor(CFA)); htd.addFamily(new HColumnDescriptor(CFB)); admin.createTable(htd); }
NamespaceDescriptor createNamespace() throws Exception { NamespaceDescriptor nd = NamespaceDescriptor.create("ns" + counter.getAndIncrement()).build(); testUtil.getAdmin().createNamespace(nd); return nd; }
@BeforeClass public static void beforeAllTests() throws Exception { // we will retry operations when PleaseHoldException is thrown TEST_UTIL.getConfiguration().setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 3); TEST_UTIL.getConfiguration().setBoolean(QuotaUtil.QUOTA_CONF_KEY, true); // Start a cluster of two regionservers. TEST_UTIL.startMiniCluster(1); TestNamespaceAuditor.waitForQuotaInitialize(TEST_UTIL); admin = TEST_UTIL.getAdmin(); }
/** * @throws java.lang.Exception */ @BeforeClass public static void setUpBeforeClass() throws Exception { TEST_UTIL.getConfiguration().setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 1); TEST_UTIL.startMiniCluster(); admin = new ReplicationAdmin(TEST_UTIL.getConfiguration()); hbaseAdmin = TEST_UTIL.getAdmin(); }
@BeforeClass public static void setUpBeforeClass() throws Exception { TEST_UTIL.getConfiguration().setLong(HConstants.HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD, timeout); TEST_UTIL.startMiniCluster(MINICLUSTER_SIZE); TEST_UTIL.getAdmin().setBalancerRunning(false, true); TABLE = createTestTable(TABLE_NAME, ROWS, FAMILIES, QUALIFIERS, VALUE); }
@After public void tearDown() throws Exception { TEST_UTIL.deleteTable(tableName); SnapshotTestingUtils.deleteAllSnapshots(TEST_UTIL.getAdmin()); SnapshotTestingUtils.deleteArchiveDirectory(TEST_UTIL); }
@Test public void testMetaHTDReplicaCount() throws Exception { assertTrue(TEST_UTIL.getAdmin().getTableDescriptor(TableName.META_TABLE_NAME) .getRegionReplication() == 3); }
@Test public void testEnableTableReplication() throws Exception { admin.enableTableRep(tableName); assertTrue(utility2.getAdmin().tableExists(tableName)); }
@BeforeClass public static void setUp() throws Exception { UTIL.startMiniCluster(1); try (Table table = UTIL.createTable(TABLE_NAME, CF)) { for (int i = 0; i < COUNT; i++) { table.put(new Put(Bytes.toBytes(i)).addColumn(CF, CQ, Bytes.toBytes(i))); } } HRI = UTIL.getAdmin().getTableRegions(TABLE_NAME).get(0); STUB = ((ConnectionImplementation) UTIL.getConnection()) .getClient(UTIL.getHBaseCluster().getRegionServer(0).getServerName()); }
@Test(expected = DoNotRetryIOException.class) public void testCreateTableWithZeroRegionReplicas() throws Exception { TableName tableName = TableName.valueOf(name.getMethodName()); TableDescriptor desc = TableDescriptorBuilder.newBuilder(tableName) .setColumnFamily(ColumnFamilyDescriptorBuilder.of(Bytes.toBytes("cf"))) .setRegionReplication(0) .build(); TEST_UTIL.getAdmin().createTable(desc); }
@Before public void setUp() throws IOException { tableName = TableName.valueOf(name.getMethodName()); TableDescriptor htd = TableDescriptorBuilder.newBuilder(tableName) .setCoprocessor(SleepAndFailFirstTime.class.getName()) .setColumnFamily(ColumnFamilyDescriptorBuilder.of(FAM_NAM)).build(); TEST_UTIL.getAdmin().createTable(htd); }
private void checkTableIsIllegal(HTableDescriptor htd) throws IOException { Admin admin = TEST_UTIL.getAdmin(); try { admin.createTable(htd); fail(); } catch(Exception ex) { // should throw ex } assertFalse(admin.tableExists(htd.getTableName())); } }
@After public void tearDown() throws Exception { ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(getMasterProcedureExecutor(), false); for (TableDescriptor htd: UTIL.getAdmin().listTableDescriptors()) { LOG.info("Tear down, remove table=" + htd.getTableName()); UTIL.deleteTable(htd.getTableName()); } }
@After public void tearDown() throws Exception { ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(getMasterProcedureExecutor(), false); for (TableDescriptor htd : UTIL.getAdmin().listTableDescriptors()) { UTIL.deleteTable(htd.getTableName()); } }
@After public void tearDown() throws Exception { assertTrue("expected executor to be running", getMasterProcedureExecutor().isRunning()); ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(getMasterProcedureExecutor(), false); for (HTableDescriptor htd: UTIL.getAdmin().listTables()) { LOG.info("Tear down, remove table=" + htd.getTableName()); UTIL.deleteTable(htd.getTableName()); } }
@Override protected Table createTable(byte[] fam) throws IOException { TableName tableName = TableName.valueOf(testName.getMethodName()); TEST_UTIL.getAdmin() .createTable(TableDescriptorBuilder.newBuilder(tableName) .setColumnFamily( ColumnFamilyDescriptorBuilder.newBuilder(fam).setNewVersionBehavior(true).build()) .build()); return TEST_UTIL.getConnection().getTable(tableName); } }
@BeforeClass public static void setupCluster() throws Exception { setupConf(conf); UTIL.startMiniCluster(2); cluster = UTIL.getHBaseCluster(); assertNotNull(cluster); admin = UTIL.getAdmin(); assertNotNull(admin); master = cluster.getMaster(); assertNotNull(master); }
@BeforeClass public static void setUp() throws Exception { UTIL.getConfiguration().setClass(HConstants.MASTER_IMPL, HMasterForTest.class, HMaster.class); UTIL .startMiniCluster(StartMiniClusterOption.builder().numMasters(2).numRegionServers(2).build()); UTIL.createTable(NAME, CF); UTIL.waitTableAvailable(NAME); UTIL.getAdmin().balancerSwitch(false, true); }