Java 类org.apache.hadoop.hbase.regionserver.StorefileRefresherChore 实例源码

项目:ditb    文件:TestReplicaWithCluster.java   
@BeforeClass
public static void beforeClass() throws Exception {
  // enable store file refreshing
  HTU.getConfiguration().setInt(
      StorefileRefresherChore.REGIONSERVER_STOREFILE_REFRESH_PERIOD, REFRESH_PERIOD);

  HTU.getConfiguration().setFloat("hbase.regionserver.logroll.multiplier", 0.0001f);
  HTU.getConfiguration().setInt("replication.source.size.capacity", 10240);
  HTU.getConfiguration().setLong("replication.source.sleepforretries", 100);
  HTU.getConfiguration().setInt("hbase.regionserver.maxlogs", 2);
  HTU.getConfiguration().setLong("hbase.master.logcleaner.ttl", 10);
  HTU.getConfiguration().setInt("zookeeper.recovery.retry", 1);
  HTU.getConfiguration().setInt("zookeeper.recovery.retry.intervalmill", 10);

  HTU.startMiniCluster(NB_SERVERS);
  HTU.getHBaseCluster().startMaster();
}
项目:ditb    文件:IntegrationTestMetaReplicas.java   
@BeforeClass
public static void setUp() throws Exception {
  // Set up the integration test util
  if (util == null) {
    util = new IntegrationTestingUtility();
  }
  util.getConfiguration().setInt(HConstants.META_REPLICAS_NUM, 3);
  util.getConfiguration().setInt(
      StorefileRefresherChore.REGIONSERVER_STOREFILE_REFRESH_PERIOD, 1000);
  // Make sure there are three servers.
  util.initializeCluster(3);
  ZooKeeperWatcher zkw = util.getZooKeeperWatcher();
  Configuration conf = util.getConfiguration();
  String baseZNode = conf.get(HConstants.ZOOKEEPER_ZNODE_PARENT,
      HConstants.DEFAULT_ZOOKEEPER_ZNODE_PARENT);
  String primaryMetaZnode = ZKUtil.joinZNode(baseZNode,
      conf.get("zookeeper.znode.metaserver", "meta-region-server"));
  // check that the data in the znode is parseable (this would also mean the znode exists)
  byte[] data = ZKUtil.getData(zkw, primaryMetaZnode);
  ServerName.parseFrom(data);
  waitUntilZnodeAvailable(1);
  waitUntilZnodeAvailable(2);
}
项目:pbase    文件:TestReplicaWithCluster.java   
@BeforeClass
public static void beforeClass() throws Exception {
  // enable store file refreshing
  HTU.getConfiguration().setInt(
      StorefileRefresherChore.REGIONSERVER_STOREFILE_REFRESH_PERIOD, REFRESH_PERIOD);

  HTU.getConfiguration().setFloat("hbase.regionserver.logroll.multiplier", 0.0001f);
  HTU.getConfiguration().setInt("replication.source.size.capacity", 10240);
  HTU.getConfiguration().setLong("replication.source.sleepforretries", 100);
  HTU.getConfiguration().setInt("hbase.regionserver.maxlogs", 2);
  HTU.getConfiguration().setLong("hbase.master.logcleaner.ttl", 10);
  HTU.getConfiguration().setInt("zookeeper.recovery.retry", 1);
  HTU.getConfiguration().setInt("zookeeper.recovery.retry.intervalmill", 10);

  HTU.startMiniCluster(NB_SERVERS);
  HTU.getHBaseCluster().startMaster();
}
项目:hbase    文件:IntegrationTestMetaReplicas.java   
@BeforeClass
public static void setUp() throws Exception {
  // Set up the integration test util
  if (util == null) {
    util = new IntegrationTestingUtility();
  }
  util.getConfiguration().setInt(HConstants.META_REPLICAS_NUM, 3);
  util.getConfiguration().setInt(
      StorefileRefresherChore.REGIONSERVER_STOREFILE_REFRESH_PERIOD, 1000);
  // Make sure there are three servers.
  util.initializeCluster(3);
  ZKWatcher zkw = util.getZooKeeperWatcher();
  Configuration conf = util.getConfiguration();
  String baseZNode = conf.get(HConstants.ZOOKEEPER_ZNODE_PARENT,
      HConstants.DEFAULT_ZOOKEEPER_ZNODE_PARENT);
  String primaryMetaZnode = ZNodePaths.joinZNode(baseZNode,
      conf.get("zookeeper.znode.metaserver", "meta-region-server"));
  // check that the data in the znode is parseable (this would also mean the znode exists)
  byte[] data = ZKUtil.getData(zkw, primaryMetaZnode);
  ProtobufUtil.toServerName(data);
  waitUntilZnodeAvailable(1);
  waitUntilZnodeAvailable(2);
}
项目:ditb    文件:TestMetaWithReplicas.java   
@Before
public void setup() throws Exception {
  TEST_UTIL.getConfiguration().setInt("zookeeper.session.timeout", 30000);
  TEST_UTIL.getConfiguration().setInt(HConstants.META_REPLICAS_NUM, 3);
  TEST_UTIL.getConfiguration().setInt(
      StorefileRefresherChore.REGIONSERVER_STOREFILE_REFRESH_PERIOD, 1000);
  TEST_UTIL.startMiniCluster(3);
  // disable the balancer
  LoadBalancerTracker l = new LoadBalancerTracker(TEST_UTIL.getZooKeeperWatcher(),
      new Abortable() {
    boolean aborted = false;
    @Override
    public boolean isAborted() {
      return aborted;
    }
    @Override
    public void abort(String why, Throwable e) {
      aborted = true;
    }
  });
  l.setBalancerOn(false);
  for (int replicaId = 1; replicaId < 3; replicaId ++) {
    HRegionInfo h = RegionReplicaUtil.getRegionInfoForReplica(HRegionInfo.FIRST_META_REGIONINFO,
      replicaId);
    TEST_UTIL.getMiniHBaseCluster().getMaster().getAssignmentManager().waitForAssignment(h);
  }
  LOG.debug("All meta replicas assigned");
}
项目:ditb    文件:TestReplicasClient.java   
@BeforeClass
public static void beforeClass() throws Exception {
  // enable store file refreshing
  HTU.getConfiguration().setInt(
      StorefileRefresherChore.REGIONSERVER_STOREFILE_REFRESH_PERIOD, REFRESH_PERIOD);
  HTU.getConfiguration().setBoolean("hbase.client.log.scanner.activity", true);
  ConnectionUtils.setupMasterlessConnection(HTU.getConfiguration());
  HTU.startMiniCluster(NB_SERVERS);

  // Create table then get the single region for our new table.
  HTableDescriptor hdt = HTU.createTableDescriptor(TestReplicasClient.class.getSimpleName());
  hdt.addCoprocessor(SlowMeCopro.class.getName());
  table = HTU.createTable(hdt, new byte[][]{f}, HTU.getConfiguration());

  hriPrimary = table.getRegionLocation(row, false).getRegionInfo();

  // mock a secondary region info to open
  hriSecondary = new HRegionInfo(hriPrimary.getTable(), hriPrimary.getStartKey(),
      hriPrimary.getEndKey(), hriPrimary.isSplit(), hriPrimary.getRegionId(), 1);

  // No master
  LOG.info("Master is going to be stopped");
  TestRegionServerNoMaster.stopMasterAndAssignMeta(HTU);
  Configuration c = new Configuration(HTU.getConfiguration());
  c.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 1);
  LOG.info("Master has stopped");
}
项目:pbase    文件:TestReplicasClient.java   
@BeforeClass
public static void beforeClass() throws Exception {
  // enable store file refreshing
  HTU.getConfiguration().setInt(
      StorefileRefresherChore.REGIONSERVER_STOREFILE_REFRESH_PERIOD, REFRESH_PERIOD);
  HTU.getConfiguration().setBoolean("hbase.client.log.scanner.activity", true);
  ConnectionUtils.setupMasterlessConnection(HTU.getConfiguration());
  HTU.startMiniCluster(NB_SERVERS);

  // Create table then get the single region for our new table.
  HTableDescriptor hdt = HTU.createTableDescriptor(TestReplicasClient.class.getSimpleName());
  hdt.addCoprocessor(SlowMeCopro.class.getName());
  table = HTU.createTable(hdt, new byte[][]{f}, HTU.getConfiguration());

  hriPrimary = table.getRegionLocation(row, false).getRegionInfo();

  // mock a secondary region info to open
  hriSecondary = new HRegionInfo(hriPrimary.getTable(), hriPrimary.getStartKey(),
      hriPrimary.getEndKey(), hriPrimary.isSplit(), hriPrimary.getRegionId(), 1);

  // No master
  LOG.info("Master is going to be stopped");
  TestRegionServerNoMaster.stopMasterAndAssignMeta(HTU);
  Configuration c = new Configuration(HTU.getConfiguration());
  c.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 1);
  LOG.info("Master has stopped");
}
项目:hbase    文件:TestReplicaWithCluster.java   
@BeforeClass
public static void beforeClass() throws Exception {
  // enable store file refreshing
  HTU.getConfiguration().setInt(StorefileRefresherChore.REGIONSERVER_STOREFILE_REFRESH_PERIOD,
      REFRESH_PERIOD);

  HTU.getConfiguration().setFloat("hbase.regionserver.logroll.multiplier", 0.0001f);
  HTU.getConfiguration().setInt("replication.source.size.capacity", 10240);
  HTU.getConfiguration().setLong("replication.source.sleepforretries", 100);
  HTU.getConfiguration().setInt("hbase.regionserver.maxlogs", 2);
  HTU.getConfiguration().setLong("hbase.master.logcleaner.ttl", 10);
  HTU.getConfiguration().setInt("zookeeper.recovery.retry", 1);
  HTU.getConfiguration().setInt("zookeeper.recovery.retry.intervalmill", 10);

  // Wait for primary call longer so make sure that it will get exception from the primary call
  HTU.getConfiguration().setInt("hbase.client.primaryCallTimeout.get", 1000000);
  HTU.getConfiguration().setInt("hbase.client.primaryCallTimeout.scan", 1000000);

  // Retry less so it can fail faster
  HTU.getConfiguration().setInt("hbase.client.retries.number", 1);

  // Enable meta replica at server side
  HTU.getConfiguration().setInt("hbase.meta.replica.count", 2);

  // Make sure master does not host system tables.
  HTU.getConfiguration().set("hbase.balancer.tablesOnMaster", "none");

  // Set system coprocessor so it can be applied to meta regions
  HTU.getConfiguration().set("hbase.coprocessor.region.classes",
      RegionServerHostingPrimayMetaRegionSlowOrStopCopro.class.getName());

  HTU.getConfiguration().setInt(HConstants.HBASE_CLIENT_META_REPLICA_SCAN_TIMEOUT,
      META_SCAN_TIMEOUT_IN_MILLISEC * 1000);

  HTU.startMiniCluster(NB_SERVERS);
  HTU.getHBaseCluster().startMaster();
}
项目:hbase    文件:TestReplicasClient.java   
@BeforeClass
public static void beforeClass() throws Exception {
  // enable store file refreshing
  HTU.getConfiguration().setInt(
      StorefileRefresherChore.REGIONSERVER_STOREFILE_REFRESH_PERIOD, REFRESH_PERIOD);
  HTU.getConfiguration().setBoolean("hbase.client.log.scanner.activity", true);
  HTU.getConfiguration().setBoolean(MetricsConnection.CLIENT_SIDE_METRICS_ENABLED_KEY, true);
  ConnectionUtils.setupMasterlessConnection(HTU.getConfiguration());
  HTU.startMiniCluster(NB_SERVERS);

  // Create table then get the single region for our new table.
  HTableDescriptor hdt = HTU.createTableDescriptor(TestReplicasClient.class.getSimpleName());
  hdt.addCoprocessor(SlowMeCopro.class.getName());
  table = HTU.createTable(hdt, new byte[][]{f}, null);

  try (RegionLocator locator = HTU.getConnection().getRegionLocator(hdt.getTableName())) {
    hriPrimary = locator.getRegionLocation(row, false).getRegionInfo();
  }

  // mock a secondary region info to open
  hriSecondary = new HRegionInfo(hriPrimary.getTable(), hriPrimary.getStartKey(),
      hriPrimary.getEndKey(), hriPrimary.isSplit(), hriPrimary.getRegionId(), 1);

  // No master
  LOG.info("Master is going to be stopped");
  TestRegionServerNoMaster.stopMasterAndAssignMeta(HTU);
  Configuration c = new Configuration(HTU.getConfiguration());
  c.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 1);
  LOG.info("Master has stopped");
}