@Override public void becomeStandby() { try { rmContext.getRMAdminService().transitionToStandby(req); } catch (Exception e) { LOG.error("RM could not transition to Standby", e); } }
@Override public void becomeStandby() { try { rmContext.getRMAdminService().transitionToStandby(req); } catch (Exception e) { LOG.error("RM could not transition to Standby", e); } }
@Override public void notLeader() { LOG.info(rmId + " relinquish leadership"); try { rm.getRMContext().getRMAdminService() .transitionToStandby( new HAServiceProtocol.StateChangeRequestInfo( HAServiceProtocol.RequestSource.REQUEST_BY_ZKFC)); } catch (Exception e) { LOG.info(rmId + " did not transition to standby successfully."); } }
@Override public void becomeStandby() { cancelDisconnectTimer(); try { rm.getRMContext().getRMAdminService().transitionToStandby(req); } catch (Exception e) { LOG.error("RM could not transition to Standby", e); } }
/** * Helper method to test that neutral mode plays well with itself. * * @param as the admin service * @param ees the embedded elector service * @throws IOException if there's an issue transitioning * @throws InterruptedException if interrupted * @throws TimeoutException if waitFor timeout reached */ private void testCallbackSynchronizationNeutral(AdminService as, ActiveStandbyElectorBasedElectorService ees) throws IOException, InterruptedException, TimeoutException { ees.enterNeutralMode(); GenericTestUtils.waitFor( () -> transitionToStandbyCounter.get() >= 1, 500, 10 * 1000); verify(as, times(1)).transitionToStandby(any()); }
/** * Helper method to test that neutral mode plays well with a standby * transition. * * @param as the admin service * @param ees the embedded elector service * @throws IOException if there's an issue transitioning * @throws InterruptedException if interrupted * @throws TimeoutException if waitFor timeout reached */ private void testCallbackSynchronizationStandby(AdminService as, ActiveStandbyElectorBasedElectorService ees) throws IOException, InterruptedException, TimeoutException { ees.becomeStandby(); GenericTestUtils.waitFor( () -> transitionToStandbyCounter.get() >= 1, 500, 10 * 1000); verify(as, times(1)).transitionToStandby(any()); }
@Override public void run() { try { rm.getRMContext().getRMAdminService().transitionToStandby(req); } catch (IOException ex) { // OK to exit } } }, "Test Unreachable ZK Thread");
/** * Helper method to test that neutral mode plays well with an active * transition. * * @param as the admin service * @param ees the embedded elector service * @throws IOException if there's an issue transitioning * @throws InterruptedException if interrupted * @throws TimeoutException if waitFor timeout reached */ private void testCallbackSynchronizationActive(AdminService as, ActiveStandbyElectorBasedElectorService ees) throws IOException, InterruptedException, TimeoutException { ees.becomeActive(); GenericTestUtils.waitFor( () -> transitionToActiveCounter.get() >= 1, 500, 10 * 1000); verify(as, times(1)).transitionToActive(any()); verify(as, never()).transitionToStandby(any()); }
/** * Helper method to test that neutral mode does not race with an active * transition. * * @param as the admin service * @param ees the embedded elector service * @throws IOException if there's an issue transitioning * @throws InterruptedException if interrupted * @throws TimeoutException if waitFor timeout reached */ private void testCallbackSynchronizationTimingStandby(AdminService as, ActiveStandbyElectorBasedElectorService ees) throws IOException, InterruptedException, TimeoutException { synchronized (ees.zkDisconnectLock) { // Sleep while holding the lock so that the timer thread can't do // anything when it runs. Sleep until we're pretty sure the timer thread // has tried to run. Thread.sleep(100); // While still holding the lock cancel the timer by transitioning. This // simulates a race where the callback goes to cancel the timer while the // timer is trying to run. ees.becomeStandby(); } // Sleep just a little more so that the timer thread can do whatever it's // going to do, hopefully nothing. Thread.sleep(50); GenericTestUtils.waitFor( () -> transitionToStandbyCounter.get() >= 1, 500, 10 * 1000); verify(as, times(1)).transitionToStandby(any()); }
() -> transitionToActiveCounter.get() >= 1, 500, 10 * 1000); verify(as, times(1)).transitionToActive(any()); verify(as, never()).transitionToStandby(any());
protected void explicitFailover() throws IOException { rm1.adminService.transitionToStandby(requestInfo); rm2.adminService.transitionToActive(requestInfo); Assert.assertTrue(rm1.getRMContext().getHAServiceState() == HAServiceState.STANDBY); Assert.assertTrue(rm2.getRMContext().getHAServiceState() == HAServiceState.ACTIVE); }
protected void explicitFailover() throws IOException { rm1.adminService.transitionToStandby(requestInfo); rm2.adminService.transitionToActive(requestInfo); Assert.assertTrue(rm1.getRMContext().getHAServiceState() == HAServiceState.STANDBY); Assert.assertTrue(rm2.getRMContext().getHAServiceState() == HAServiceState.ACTIVE); }
rm1.init(conf); rm1.start(); rm1.getAdminService().transitionToStandby(requestInfo);
rm.adminService.transitionToStandby(requestInfo);
rm.adminService.transitionToStandby(requestInfo); checkMonitorHealth(); checkStandbyRMFunctionality();
private void explicitFailover(MockRM rm) throws IOException { rm.getAdminService().transitionToStandby(requestInfo); Assert.assertTrue(rm.getRMContext() .getHAServiceState() == HAServiceProtocol.HAServiceState.STANDBY); rm.getAdminService().transitionToActive(requestInfo); Assert.assertTrue(rm.getRMContext() .getHAServiceState() == HAServiceProtocol.HAServiceState.ACTIVE); lastHearbeatTS = 0; stateStore = rm.getFederationStateStoreService().getStateStoreClient(); }
rm.adminService.transitionToStandby(requestInfo); checkStandbyRMFunctionality(); rm.stop();
rm.adminService.transitionToStandby(requestInfo); fail(ERR_UNFORCED_REQUEST); } catch (AccessControlException e) { rm.adminService.transitionToStandby(requestInfo); } catch (AccessControlException e) { fail(ERR_FORCED_REQUEST);
rm.adminService.transitionToStandby(requestInfo); fail(ERR_UNFORCED_REQUEST); } catch (AccessControlException e) { rm.adminService.transitionToStandby(requestInfo); } catch (AccessControlException e) { fail(ERR_FORCED_REQUEST);
new HAServiceProtocol.StateChangeRequestInfo( HAServiceProtocol.RequestSource.REQUEST_BY_USER); rm2.adminService.transitionToStandby(requestInfo); rm1.adminService.transitionToActive(requestInfo); Assert.assertTrue(rm2.getRMContext().getHAServiceState()