/** * Release the lock. * No-op if the lock was never acquired. */ public void release() { if (proc != null) { proc.unlock(master.getMasterProcedureExecutor().getEnvironment()); } proc = null; }
private void submitProcedure(final LockProcedure proc, final NonceKey nonceKey) { proc.setOwner(master.getMasterProcedureExecutor().getEnvironment().getRequestUser()); master.getMasterProcedureExecutor().submitProcedure(proc, nonceKey); }
private ProcedureExecutor<MasterProcedureEnv> getMasterProcedureExecutor() { return UTIL.getHBaseCluster().getMaster().getMasterProcedureExecutor(); } }
private ProcedureExecutor<MasterProcedureEnv> getMasterProcedureExecutor() { return UTIL.getHBaseCluster().getMaster().getMasterProcedureExecutor(); } private void resetProcExecutorTestingKillFlag() {
private ProcedureExecutor<MasterProcedureEnv> getMasterProcedureExecutor() { return UTIL.getHBaseCluster().getMaster().getMasterProcedureExecutor(); } }
private ProcedureExecutor<MasterProcedureEnv> getMasterProcedureExecutor() { return UTIL.getHBaseCluster().getMaster().getMasterProcedureExecutor(); }
private ProcedureExecutor<MasterProcedureEnv> getMasterProcedureExecutor() { return UTIL.getHBaseCluster().getMaster().getMasterProcedureExecutor(); }
private ProcedureExecutor<MasterProcedureEnv> getMasterProcedureExecutor() { return UTIL.getHBaseCluster().getMaster().getMasterProcedureExecutor(); }
@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(); }
@After public void teardown() throws Exception { ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate( master.getMasterProcedureExecutor(), false); TEST_UTIL.shutdownMiniCluster(); }
@BeforeClass public static void setUpBeforeClass() throws Exception { TEST_UTIL.startMiniCluster(3); TEST_UTIL.createMultiRegionTable(TABLE_NAME, Bytes.toBytes("family1"), 5); procExec = TEST_UTIL.getMiniHBaseCluster().getMaster().getMasterProcedureExecutor(); ASYNC_CONN = ConnectionFactory.createAsyncConnection(TEST_UTIL.getConfiguration()).get(); }
private void waitOnPids(List<Long> pids) { for (Long pid: pids) { while (!TEST_UTIL.getHBaseCluster().getMaster().getMasterProcedureExecutor(). isFinished(pid)) { Threads.sleep(100); } } } }
private void requestSplitRegion( final HRegionServer rsServer, final Region region, final byte[] midKey) throws IOException { long procId = cluster.getMaster().splitRegion(region.getRegionInfo(), midKey, 0, 0); // wait for the split to complete or get interrupted. If the split completes successfully, // the procedure will return true; if the split fails, the procedure would throw exception. ProcedureTestingUtility.waitProcedure(cluster.getMaster().getMasterProcedureExecutor(), procId); }
private void resetProcExecutorTestingKillFlag() { ProcedureExecutor<MasterProcedureEnv> procExec = UTIL.getHBaseCluster().getMaster().getMasterProcedureExecutor(); ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, false); assertTrue("expected executor to be running", procExec.isRunning()); }
@Test public void testRecoveryAndDoubleExecutionMove() throws Exception { MasterProcedureEnv env = UTIL.getMiniHBaseCluster().getMaster().getMasterProcedureExecutor().getEnvironment(); HRegion region = UTIL.getMiniHBaseCluster().getRegions(tableName).get(0); long openSeqNum = region.getOpenSeqNum(); TransitRegionStateProcedure proc = TransitRegionStateProcedure.move(env, region.getRegionInfo(), null); testRecoveryAndDoubleExcution(proc); HRegion region2 = UTIL.getMiniHBaseCluster().getRegions(tableName).get(0); long openSeqNum2 = region2.getOpenSeqNum(); // confirm that the region is successfully opened assertTrue(openSeqNum2 > openSeqNum); }
@Test public void testCrashProcedureReplay() { HMaster master = TEST_UTIL.getHBaseCluster().getMaster(); final ProcedureExecutor<MasterProcedureEnv> pExecutor = master.getMasterProcedureExecutor(); ServerCrashProcedure proc = new ServerCrashProcedure( pExecutor.getEnvironment(), hostname123, false, false); ProcedureTestingUtility.submitAndWait(pExecutor, proc); assertFalse(master.getServerManager().getDeadServers().areDeadServersInProgress()); }
@BeforeClass public static void setupCluster() throws Exception { UTIL.startMiniCluster(RS_NUMBER); UTIL.getHBaseCluster().waitForActiveAndReadyMaster(); conf = UTIL.getConfiguration(); HMaster master = UTIL.getHBaseCluster().getMaster(); fs = master.getMasterFileSystem().getWALFileSystem(); syncReplicationReplayWALManager = master.getSyncReplicationReplayWALManager(); procExec = master.getMasterProcedureExecutor(); }
@BeforeClass public static void setUp() throws Exception { UTIL.startMiniCluster(1); UTIL.getAdmin().balancerSwitch(false, true); UTIL.createTable(TableDescriptorBuilder.newBuilder(TABLE_NAME) .setColumnFamily(ColumnFamilyDescriptorBuilder.of("cf")) .setRegionReplication(REGION_REPLICATION).build(), new byte[][] { Bytes.toBytes(0) }); UTIL.waitTableAvailable(TABLE_NAME); HMaster master = UTIL.getMiniHBaseCluster().getMaster(); ENV = master.getMasterProcedureExecutor().getEnvironment(); AM = master.getAssignmentManager(); }
@Before public void setup() throws Exception { this.util = new HBaseTestingUtility(); setupConf(this.util.getConfiguration()); startMiniCluster(); ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate( this.util.getHBaseCluster().getMaster().getMasterProcedureExecutor(), false); serverCrashProcMetrics = this.util.getHBaseCluster().getMaster().getMasterMetrics() .getServerCrashProcMetrics(); }
private void testRecoveryAndDoubleExcution(TransitRegionStateProcedure proc) throws Exception { HMaster master = UTIL.getHBaseCluster().getMaster(); AssignmentManager am = master.getAssignmentManager(); RegionStateNode regionNode = am.getRegionStates().getRegionStateNode(proc.getRegion()); assertFalse(regionNode.isInTransition()); regionNode.setProcedure(proc); assertTrue(regionNode.isInTransition()); ProcedureExecutor<MasterProcedureEnv> procExec = master.getMasterProcedureExecutor(); ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, true); long procId = procExec.submitProcedure(proc); MasterProcedureTestingUtility.testRecoveryAndDoubleExecution(procExec, procId); regionNode = am.getRegionStates().getRegionStateNode(proc.getRegion()); assertFalse(regionNode.isInTransition()); }