当前位置: 首页>>代码示例>>Java>>正文


Java HMaster.getMasterProcedureExecutor方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.master.HMaster.getMasterProcedureExecutor方法的典型用法代码示例。如果您正苦于以下问题:Java HMaster.getMasterProcedureExecutor方法的具体用法?Java HMaster.getMasterProcedureExecutor怎么用?Java HMaster.getMasterProcedureExecutor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.master.HMaster的用法示例。


在下文中一共展示了HMaster.getMasterProcedureExecutor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: tearDown

import org.apache.hadoop.hbase.master.HMaster; //导入方法依赖的package包/类
@After
public void tearDown() throws Exception {
  MiniHBaseCluster cluster = this.util.getHBaseCluster();
  HMaster master = cluster == null? null: cluster.getMaster();
  if (master != null && master.getMasterProcedureExecutor() != null) {
    ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(master.getMasterProcedureExecutor(),
      false);
  }
  this.util.shutdownMiniCluster();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:11,代码来源:TestServerCrashProcedure.java

示例2: testRecoveryAndDoubleExecutionOnline

import org.apache.hadoop.hbase.master.HMaster; //导入方法依赖的package包/类
/**
 * Run server crash procedure steps twice to test idempotency and that we are persisting all
 * needed state.
 * @throws Exception
 */
@Test(timeout = 300000)
public void testRecoveryAndDoubleExecutionOnline() throws Exception {
  final TableName tableName = TableName.valueOf("testRecoveryAndDoubleExecutionOnline");
  this.util.createTable(tableName, HBaseTestingUtility.COLUMNS,
    HBaseTestingUtility.KEYS_FOR_HBA_CREATE_TABLE);
  try (Table t = this.util.getConnection().getTable(tableName)) {
    // Load the table with a bit of data so some logs to split and some edits in each region.
    this.util.loadTable(t, HBaseTestingUtility.COLUMNS[0]);
    int count = countRows(t);
    // Run the procedure executor outside the master so we can mess with it. Need to disable
    // Master's running of the server crash processing.
    HMaster master = this.util.getHBaseCluster().getMaster();
    final ProcedureExecutor<MasterProcedureEnv> procExec = master.getMasterProcedureExecutor();
    master.setServerCrashProcessingEnabled(false);
    // Kill a server. Master will notice but do nothing other than add it to list of dead servers.
    HRegionServer hrs = this.util.getHBaseCluster().getRegionServer(0);
    boolean carryingMeta = (master.getAssignmentManager().isCarryingMeta(hrs.getServerName()) ==
        AssignmentManager.ServerHostRegion.HOSTING_REGION);
    this.util.getHBaseCluster().killRegionServer(hrs.getServerName());
    hrs.join();
    // Wait until the expiration of the server has arrived at the master. We won't process it
    // by queuing a ServerCrashProcedure because we have disabled crash processing... but wait
    // here so ServerManager gets notice and adds expired server to appropriate queues.
    while (!master.getServerManager().isServerDead(hrs.getServerName())) Threads.sleep(10);
    // Now, reenable processing else we can't get a lock on the ServerCrashProcedure.
    master.setServerCrashProcessingEnabled(true);
    // Do some of the master processing of dead servers so when SCP runs, it has expected 'state'.
    master.getServerManager().moveFromOnelineToDeadServers(hrs.getServerName());
    // Enable test flags and then queue the crash procedure.
    ProcedureTestingUtility.waitNoProcedureRunning(procExec);
    ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, true);
    long procId =
      procExec.submitProcedure(new ServerCrashProcedure(hrs.getServerName(), true, carryingMeta));
    // Now run through the procedure twice crashing the executor on each step...
    MasterProcedureTestingUtility.testRecoveryAndDoubleExecution(procExec, procId);
    // Assert all data came back.
    assertEquals(count, countRows(t));
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:45,代码来源:TestServerCrashProcedure.java

示例3: testMasterInitializedEvent

import org.apache.hadoop.hbase.master.HMaster; //导入方法依赖的package包/类
@Test
public void testMasterInitializedEvent() throws Exception {
  TableName tableName = TableName.valueOf("testMasterInitializedEvent");
  HMaster master = UTIL.getMiniHBaseCluster().getMaster();
  ProcedureExecutor<MasterProcedureEnv> procExec = master.getMasterProcedureExecutor();
  MasterProcedureScheduler procSched = procExec.getEnvironment().getProcedureQueue();

  HRegionInfo hri = new HRegionInfo(tableName);
  HTableDescriptor htd = new HTableDescriptor(tableName);
  HColumnDescriptor hcd = new HColumnDescriptor("f");
  htd.addFamily(hcd);

  while (!master.isInitialized()) Thread.sleep(250);
  master.setInitialized(false); // fake it, set back later

  CreateTableProcedure proc = new CreateTableProcedure(
    procExec.getEnvironment(), htd, new HRegionInfo[] { hri });

  long pollCalls = procSched.getPollCalls();
  long nullPollCalls = procSched.getNullPollCalls();

  long procId = procExec.submitProcedure(proc, HConstants.NO_NONCE, HConstants.NO_NONCE);
  for (int i = 0; i < 10; ++i) {
    Thread.sleep(100);
    assertEquals(pollCalls + 1, procSched.getPollCalls());
    assertEquals(nullPollCalls, procSched.getNullPollCalls());
  }

  master.setInitialized(true);
  ProcedureTestingUtility.waitProcedure(procExec, procId);

  assertEquals(pollCalls + 2, procSched.getPollCalls());
  assertEquals(nullPollCalls, procSched.getNullPollCalls());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:35,代码来源:TestMasterProcedureEvents.java

示例4: testServerCrashProcedureEvent

import org.apache.hadoop.hbase.master.HMaster; //导入方法依赖的package包/类
@Test
public void testServerCrashProcedureEvent() throws Exception {
  TableName tableName = TableName.valueOf("testServerCrashProcedureEventTb");
  HMaster master = UTIL.getMiniHBaseCluster().getMaster();
  ProcedureExecutor<MasterProcedureEnv> procExec = master.getMasterProcedureExecutor();
  MasterProcedureScheduler procSched = procExec.getEnvironment().getProcedureQueue();

  while (!master.isServerCrashProcessingEnabled() || !master.isInitialized() ||
      master.getAssignmentManager().getRegionStates().isRegionsInTransition()) {
    Thread.sleep(25);
  }

  UTIL.createTable(tableName, HBaseTestingUtility.COLUMNS[0]);
  try (Table t = UTIL.getConnection().getTable(tableName)) {
    // Load the table with a bit of data so some logs to split and some edits in each region.
    UTIL.loadTable(t, HBaseTestingUtility.COLUMNS[0]);
  }

  master.setServerCrashProcessingEnabled(false);  // fake it, set back later

  long pollCalls = procSched.getPollCalls();
  long nullPollCalls = procSched.getNullPollCalls();

  // Kill a server. Master will notice but do nothing other than add it to list of dead servers.
  HRegionServer hrs = getServerWithRegions();
  boolean carryingMeta = master.getAssignmentManager()
      .isCarryingMeta(hrs.getServerName()) == AssignmentManager.ServerHostRegion.HOSTING_REGION;
  UTIL.getHBaseCluster().killRegionServer(hrs.getServerName());
  hrs.join();

  // Wait until the expiration of the server has arrived at the master. We won't process it
  // by queuing a ServerCrashProcedure because we have disabled crash processing... but wait
  // here so ServerManager gets notice and adds expired server to appropriate queues.
  while (!master.getServerManager().isServerDead(hrs.getServerName())) Thread.sleep(10);

  // Do some of the master processing of dead servers so when SCP runs, it has expected 'state'.
  master.getServerManager().moveFromOnelineToDeadServers(hrs.getServerName());

  long procId = procExec.submitProcedure(
    new ServerCrashProcedure(hrs.getServerName(), true, carryingMeta));

  for (int i = 0; i < 10; ++i) {
    Thread.sleep(100);
    assertEquals(pollCalls + 1, procSched.getPollCalls());
    assertEquals(nullPollCalls, procSched.getNullPollCalls());
  }

  // Now, reenable processing else we can't get a lock on the ServerCrashProcedure.
  master.setServerCrashProcessingEnabled(true);
  ProcedureTestingUtility.waitProcedure(procExec, procId);

  LOG.debug("server crash processing poll calls: " + procSched.getPollCalls());
  assertTrue(procSched.getPollCalls() >= (pollCalls + 2));
  assertEquals(nullPollCalls, procSched.getNullPollCalls());

  UTIL.deleteTable(tableName);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:58,代码来源:TestMasterProcedureEvents.java


注:本文中的org.apache.hadoop.hbase.master.HMaster.getMasterProcedureExecutor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。