use of org.apache.hadoop.hbase.master.HMaster in project hbase by apache.
the class TestHbck method testRunHbckChore.
@Test
public void testRunHbckChore() throws Exception {
HMaster master = TEST_UTIL.getMiniHBaseCluster().getMaster();
long endTimestamp = master.getHbckChore().getCheckingEndTimestamp();
Hbck hbck = getHbck();
boolean ran = false;
while (!ran) {
ran = hbck.runHbckChore();
if (ran) {
assertTrue(master.getHbckChore().getCheckingEndTimestamp() > endTimestamp);
}
}
}
use of org.apache.hadoop.hbase.master.HMaster in project hbase by apache.
the class TestIncreaseMetaReplicaThroughConfig method testUpgradeAndIncreaseReplicaCount.
@Test
public void testUpgradeAndIncreaseReplicaCount() throws Exception {
HMaster oldMaster = TEST_UTIL.getMiniHBaseCluster().getMaster();
TableDescriptors oldTds = oldMaster.getTableDescriptors();
TableDescriptor oldMetaTd = oldTds.get(TableName.META_TABLE_NAME);
assertEquals(3, oldMetaTd.getRegionReplication());
// force update the replica count to 1 and then kill the master, to simulate that hen upgrading,
// we have no region replication in meta table descriptor but we actually have meta region
// replicas
oldTds.update(TableDescriptorBuilder.newBuilder(oldMetaTd).setRegionReplication(1).build());
oldMaster.stop("Restarting");
TEST_UTIL.waitFor(30000, () -> oldMaster.isStopped());
// increase replica count to 5 through Configuration
TEST_UTIL.getMiniHBaseCluster().getConfiguration().setInt(HConstants.META_REPLICAS_NUM, 5);
TEST_UTIL.getMiniHBaseCluster().startMaster();
TEST_UTIL.waitFor(30000, () -> TEST_UTIL.getZooKeeperWatcher().getMetaReplicaNodes().size() == 5);
}
use of org.apache.hadoop.hbase.master.HMaster in project hbase by apache.
the class TestMasterRegistry method testRegistryRPCs.
@Test
public void testRegistryRPCs() throws Exception {
Configuration conf = new Configuration(TEST_UTIL.getConfiguration());
HMaster activeMaster = TEST_UTIL.getHBaseCluster().getMaster();
final int size = activeMaster.getMetaLocations().size();
for (int numHedgedReqs = 1; numHedgedReqs <= size; numHedgedReqs++) {
conf.setInt(MasterRegistry.MASTER_REGISTRY_HEDGED_REQS_FANOUT_KEY, numHedgedReqs);
try (MasterRegistry registry = new MasterRegistry(conf)) {
// Add wait on all replicas being assigned before proceeding w/ test. Failed on occasion
// because not all replicas had made it up before test started.
RegionReplicaTestHelper.waitUntilAllMetaReplicasAreReady(TEST_UTIL, registry);
assertEquals(registry.getClusterId().get(), activeMaster.getClusterId());
assertEquals(registry.getActiveMaster().get(), activeMaster.getServerName());
List<HRegionLocation> metaLocations = Arrays.asList(registry.getMetaRegionLocations().get().getRegionLocations());
List<HRegionLocation> actualMetaLocations = activeMaster.getMetaLocations();
Collections.sort(metaLocations);
Collections.sort(actualMetaLocations);
assertEquals(actualMetaLocations, metaLocations);
}
}
}
use of org.apache.hadoop.hbase.master.HMaster in project hbase by apache.
the class TestMetaRegionLocationCache method testStandByMetaLocations.
@Test
public void testStandByMetaLocations() throws Exception {
HMaster standBy = TEST_UTIL.getMiniHBaseCluster().startMaster().getMaster();
verifyCachedMetaLocations(standBy);
}
use of org.apache.hadoop.hbase.master.HMaster in project hbase by apache.
the class TestRpcConnectionRegistry method testRegistryRPCs.
@Test
public void testRegistryRPCs() throws Exception {
HMaster activeMaster = UTIL.getHBaseCluster().getMaster();
// sleep 3 seconds, since our initial delay is 1 second, we should have refreshed the endpoints
Thread.sleep(3000);
assertThat(registry.getParsedServers(), hasItems(activeMaster.getServerManager().getOnlineServersList().toArray(new ServerName[0])));
// Add wait on all replicas being assigned before proceeding w/ test. Failed on occasion
// because not all replicas had made it up before test started.
RegionReplicaTestHelper.waitUntilAllMetaReplicasAreReady(UTIL, registry);
assertEquals(registry.getClusterId().get(), activeMaster.getClusterId());
assertEquals(registry.getActiveMaster().get(), activeMaster.getServerName());
List<HRegionLocation> metaLocations = Arrays.asList(registry.getMetaRegionLocations().get().getRegionLocations());
List<HRegionLocation> actualMetaLocations = activeMaster.getMetaLocations();
Collections.sort(metaLocations);
Collections.sort(actualMetaLocations);
assertEquals(actualMetaLocations, metaLocations);
// test that the node count config works
setMaxNodeCount(1);
UTIL.waitFor(10000, () -> registry.getParsedServers().size() == 1);
}
Aggregations