@Override public void transition(RMAppImpl app, RMAppEvent event) { // If recovery is enabled then store the application information in a // non-blocking call so make sure that RM has stored the information // needed to restart the AM after RM restart without further client // communication LOG.info("Storing application with id " + app.applicationId); app.rmContext.getStateStore().storeNewApplication(app); } }
public TestRMAppManager(RMContext context, ClientToAMTokenSecretManagerInRM clientToAMSecretManager, YarnScheduler scheduler, ApplicationMasterService masterService, ApplicationACLsManager applicationACLsManager, Configuration conf) { super(context, scheduler, masterService, applicationACLsManager, conf); this.stateStore = context.getStateStore(); }
@Override public void transition(RMAppImpl app, RMAppEvent event) { // If recovery is enabled then store the application information in a // non-blocking call so make sure that RM has stored the information // needed to restart the AM after RM restart without further client // communication LOG.info("Storing application with id " + app.applicationId); app.rmContext.getStateStore().storeNewApplication(app); } }
@Override public void recover(RMState state) throws Exception { RMStateStore store = rmContext.getStateStore(); assert store != null; // recover applications Map<ApplicationId, ApplicationStateData> appStates = state.getApplicationState(); LOG.info("Recovering " + appStates.size() + " applications"); for (ApplicationStateData appState : appStates.values()) { recoverApplication(appState, state); } }
@Override public void recover(RMState state) throws Exception { RMStateStore store = rmContext.getStateStore(); assert store != null; // recover applications Map<ApplicationId, ApplicationStateData> appStates = state.getApplicationState(); LOG.info("Recovering " + appStates.size() + " applications"); for (ApplicationStateData appState : appStates.values()) { recoverApplication(appState, state); } }
@Override protected void updateStoredToken(RMDelegationTokenIdentifier id, long renewDate) { try { LOG.info("updating RMDelegation token with sequence number: " + id.getSequenceNumber()); rmContext.getStateStore().updateRMDelegationToken(id, renewDate); } catch (Exception e) { LOG.error("Error in updating persisted RMDelegationToken" + " with sequence number: " + id.getSequenceNumber()); ExitUtil.terminate(1, e); } }
@Override protected void removeStoredMasterKey(DelegationKey key) { try { LOG.info("removing master key with keyID " + key.getKeyId()); rmContext.getStateStore().removeRMDTMasterKey(key); } catch (Exception e) { LOG.error("Error in removing master key with KeyID: " + key.getKeyId()); ExitUtil.terminate(1, e); } }
@Override protected void removeStoredMasterKey(DelegationKey key) { try { LOG.info("removing master key with keyID " + key.getKeyId()); rmContext.getStateStore().removeRMDTMasterKey(key); } catch (Exception e) { LOG.error("Error in removing master key with KeyID: " + key.getKeyId()); ExitUtil.terminate(1, e); } }
@Override protected void storeNewToken(RMDelegationTokenIdentifier identifier, long renewDate) { try { LOG.info("storing RMDelegation token with sequence number: " + identifier.getSequenceNumber()); rmContext.getStateStore().storeRMDelegationToken(identifier, renewDate); } catch (Exception e) { LOG.error("Error in storing RMDelegationToken with sequence number: " + identifier.getSequenceNumber()); ExitUtil.terminate(1, e); } }
@Override protected void removeStoredToken(RMDelegationTokenIdentifier ident) throws IOException { try { LOG.info("removing RMDelegation token with sequence number: " + ident.getSequenceNumber()); rmContext.getStateStore().removeRMDelegationToken(ident); } catch (Exception e) { LOG.error("Error in removing RMDelegationToken with sequence number: " + ident.getSequenceNumber()); ExitUtil.terminate(1, e); } }
@Override protected void storeNewToken(RMDelegationTokenIdentifier identifier, long renewDate) { try { LOG.info("storing RMDelegation token with sequence number: " + identifier.getSequenceNumber()); rmContext.getStateStore().storeRMDelegationToken(identifier, renewDate); } catch (Exception e) { LOG.error("Error in storing RMDelegationToken with sequence number: " + identifier.getSequenceNumber()); ExitUtil.terminate(1, e); } }
private void storeAttempt() { // store attempt data in a non-blocking manner to prevent dispatcher // thread starvation and wait for state to be saved LOG.info("Storing attempt: AppId: " + getAppAttemptId().getApplicationId() + " AttemptId: " + getAppAttemptId() + " MasterContainer: " + masterContainer); rmContext.getStateStore().storeNewApplicationAttempt(this); }
public static RMContext createMockRMContext() { RMContext context = mock(RMContext.class); when(context.getStateStore()).thenReturn(new MemoryRMStateStore()); return context; }
public RMStateStore getRMStateStore() { return getRMContext().getStateStore(); } }
@Override protected void removeStoredMasterKey(DelegationKey key) { try { LOG.info("removing master key with keyID " + key.getKeyId()); rm.getRMContext().getStateStore().removeRMDTMasterKey(key); } catch (Exception e) { if (!shouldIgnoreException(e)) { LOG.error("Error in removing master key with KeyID: " + key.getKeyId()); ExitUtil.terminate(1, e); } } }
public void start() { if (this.currentMasterKey == null) { this.currentMasterKey = createNewMasterKey(); AMRMTokenSecretManagerState state = AMRMTokenSecretManagerState.newInstance( this.currentMasterKey.getMasterKey(), null); rmContext.getStateStore().storeOrUpdateAMRMTokenSecretManager(state, false); } this.timer.scheduleAtFixedRate(new MasterKeyRoller(), rollingInterval, rollingInterval); }
public void start() { if (this.currentMasterKey == null) { this.currentMasterKey = createNewMasterKey(); AMRMTokenSecretManagerState state = AMRMTokenSecretManagerState.newInstance( this.currentMasterKey.getMasterKey(), null); rmContext.getStateStore().storeOrUpdateAMRMTokenSecretManager(state, false); } this.timer.scheduleAtFixedRate(new MasterKeyRoller(), rollingInterval, rollingInterval); }
public void start() { if (this.currentMasterKey == null) { this.currentMasterKey = createNewMasterKey(); AMRMTokenSecretManagerState state = AMRMTokenSecretManagerState.newInstance( this.currentMasterKey.getMasterKey(), null); rmContext.getStateStore().storeOrUpdateAMRMTokenSecretManager(state, false); } this.timer.scheduleAtFixedRate(new MasterKeyRoller(), rollingInterval, rollingInterval); }
@BeforeClass public static void setupSecretManager() throws IOException { RMContext rmContext = mock(RMContext.class); when(rmContext.getStateStore()).thenReturn(new NullRMStateStore()); dtsm = new RMDelegationTokenSecretManager(60000, 60000, 60000, 60000, rmContext); dtsm.startThreads(); }
@Before public void setUp() throws IOException { scheduler = new FairScheduler(); conf = createConfiguration(); resourceManager = new MockRM(conf); ((AsyncDispatcher)resourceManager.getRMContext().getDispatcher()).start(); resourceManager.getRMContext().getStateStore().start(); // to initialize the master key resourceManager.getRMContext().getContainerTokenSecretManager().rollMasterKey(); scheduler.setRMContext(resourceManager.getRMContext()); }