|
@@ -791,7 +791,9 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
|
|
|
/**
|
|
|
* Dispatcher used to send state operation completion events to
|
|
|
- * ResourceManager services
|
|
|
+ * ResourceManager services.
|
|
|
+ *
|
|
|
+ * @param dispatcher Dispatcher.
|
|
|
*/
|
|
|
public void setRMDispatcher(Dispatcher dispatcher) {
|
|
|
this.rmDispatcher = dispatcher;
|
|
@@ -827,13 +829,18 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
|
|
|
/**
|
|
|
* Derived classes initialize themselves using this method.
|
|
|
+ *
|
|
|
+ * @param conf Configuration.
|
|
|
+ * @throws Exception error occur.
|
|
|
*/
|
|
|
protected abstract void initInternal(Configuration conf) throws Exception;
|
|
|
|
|
|
/**
|
|
|
* Derived classes start themselves using this method.
|
|
|
* The base class is started and the event dispatcher is ready to use at
|
|
|
- * this point
|
|
|
+ * this point.
|
|
|
+ *
|
|
|
+ * @throws Exception error occur.
|
|
|
*/
|
|
|
protected abstract void startInternal() throws Exception;
|
|
|
|
|
@@ -846,7 +853,9 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
/**
|
|
|
* Derived classes close themselves using this method.
|
|
|
* The base class will be closed and the event dispatcher will be shutdown
|
|
|
- * after this
|
|
|
+ * after this.
|
|
|
+ *
|
|
|
+ * @throws Exception error occur.
|
|
|
*/
|
|
|
protected abstract void closeInternal() throws Exception;
|
|
|
|
|
@@ -860,6 +869,8 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
* 5) Within a major upgrade, say 1.2 to 2.0:
|
|
|
* throw exception and indicate user to use a separate upgrade tool to
|
|
|
* upgrade RM state.
|
|
|
+ *
|
|
|
+ * @throws Exception error occur.
|
|
|
*/
|
|
|
public void checkVersion() throws Exception {
|
|
|
Version loadedVersion = loadVersion();
|
|
@@ -884,22 +895,28 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
/**
|
|
|
* Derived class use this method to load the version information from state
|
|
|
* store.
|
|
|
+ * @throws Exception error occur.
|
|
|
+ * @return current version.
|
|
|
*/
|
|
|
protected abstract Version loadVersion() throws Exception;
|
|
|
|
|
|
/**
|
|
|
* Derived class use this method to store the version information.
|
|
|
+ * @throws Exception error occur.
|
|
|
*/
|
|
|
protected abstract void storeVersion() throws Exception;
|
|
|
|
|
|
/**
|
|
|
* Get the current version of the underlying state store.
|
|
|
+ * @return current version.
|
|
|
*/
|
|
|
protected abstract Version getCurrentVersion();
|
|
|
|
|
|
|
|
|
/**
|
|
|
* Get the current epoch of RM and increment the value.
|
|
|
+ * @throws Exception error occur.
|
|
|
+ * @return current epoch.
|
|
|
*/
|
|
|
public abstract long getAndIncrementEpoch() throws Exception;
|
|
|
|
|
@@ -907,6 +924,9 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
* Compute the next epoch value by incrementing by one.
|
|
|
* Wraps around if the epoch range is exceeded so that
|
|
|
* when federation is enabled epoch collisions can be avoided.
|
|
|
+ *
|
|
|
+ * @param epoch epoch value.
|
|
|
+ * @return next epoch value.
|
|
|
*/
|
|
|
protected long nextEpoch(long epoch){
|
|
|
long epochVal = epoch - baseEpoch + 1;
|
|
@@ -920,7 +940,9 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
* Blocking API
|
|
|
* The derived class must recover state from the store and return a new
|
|
|
* RMState object populated with that state
|
|
|
- * This must not be called on the dispatcher thread
|
|
|
+ * This must not be called on the dispatcher thread.
|
|
|
+ * @throws Exception error occur.
|
|
|
+ * @return RMState.
|
|
|
*/
|
|
|
public abstract RMState loadState() throws Exception;
|
|
|
|
|
@@ -928,7 +950,9 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
* Non-Blocking API
|
|
|
* ResourceManager services use this to store the application's state
|
|
|
* This does not block the dispatcher threads
|
|
|
- * RMAppStoredEvent will be sent on completion to notify the RMApp
|
|
|
+ * RMAppStoredEvent will be sent on completion to notify the RMApp.
|
|
|
+ *
|
|
|
+ * @param app rmApp.
|
|
|
*/
|
|
|
@SuppressWarnings("unchecked")
|
|
|
public void storeNewApplication(RMApp app) {
|
|
@@ -969,6 +993,10 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
* Blocking API
|
|
|
* Derived classes must implement this method to store the state of an
|
|
|
* application.
|
|
|
+ *
|
|
|
+ * @param appId application Id.
|
|
|
+ * @param appStateData application StateData.
|
|
|
+ * @throws Exception error occur.
|
|
|
*/
|
|
|
protected abstract void storeApplicationStateInternal(ApplicationId appId,
|
|
|
ApplicationStateData appStateData) throws Exception;
|
|
@@ -981,7 +1009,9 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
* Non-blocking API
|
|
|
* ResourceManager services call this to store state on an application attempt
|
|
|
* This does not block the dispatcher threads
|
|
|
- * RMAppAttemptStoredEvent will be sent on completion to notify the RMAppAttempt
|
|
|
+ * RMAppAttemptStoredEvent will be sent on completion to notify the RMAppAttempt.
|
|
|
+ *
|
|
|
+ * @param appAttempt RM AppAttempt.
|
|
|
*/
|
|
|
public void storeNewApplicationAttempt(RMAppAttempt appAttempt) {
|
|
|
Credentials credentials = getCredentialsFromAppAttempt(appAttempt);
|
|
@@ -1011,7 +1041,11 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
/**
|
|
|
* Blocking API
|
|
|
* Derived classes must implement this method to store the state of an
|
|
|
- * application attempt
|
|
|
+ * application attempt.
|
|
|
+ *
|
|
|
+ * @param attemptId Application AttemptId.
|
|
|
+ * @param attemptStateData Application AttemptStateData.
|
|
|
+ * @throws Exception error occur.
|
|
|
*/
|
|
|
protected abstract void storeApplicationAttemptStateInternal(
|
|
|
ApplicationAttemptId attemptId,
|
|
@@ -1023,7 +1057,10 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
|
|
|
/**
|
|
|
* RMDTSecretManager call this to store the state of a delegation token
|
|
|
- * and sequence number
|
|
|
+ * and sequence number.
|
|
|
+ *
|
|
|
+ * @param rmDTIdentifier RMDelegationTokenIdentifier.
|
|
|
+ * @param renewDate token renew date.
|
|
|
*/
|
|
|
public void storeRMDelegationToken(
|
|
|
RMDelegationTokenIdentifier rmDTIdentifier, Long renewDate) {
|
|
@@ -1034,14 +1071,20 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
/**
|
|
|
* Blocking API
|
|
|
* Derived classes must implement this method to store the state of
|
|
|
- * RMDelegationToken and sequence number
|
|
|
+ * RMDelegationToken and sequence number.
|
|
|
+ *
|
|
|
+ * @param rmDTIdentifier RMDelegationTokenIdentifier.
|
|
|
+ * @param renewDate token renew date.
|
|
|
+ * @throws Exception error occur.
|
|
|
*/
|
|
|
protected abstract void storeRMDelegationTokenState(
|
|
|
RMDelegationTokenIdentifier rmDTIdentifier, Long renewDate)
|
|
|
throws Exception;
|
|
|
|
|
|
/**
|
|
|
- * RMDTSecretManager call this to remove the state of a delegation token
|
|
|
+ * RMDTSecretManager call this to remove the state of a delegation token.
|
|
|
+ *
|
|
|
+ * @param rmDTIdentifier RMDelegationTokenIdentifier.
|
|
|
*/
|
|
|
public void removeRMDelegationToken(
|
|
|
RMDelegationTokenIdentifier rmDTIdentifier) {
|
|
@@ -1051,14 +1094,20 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
|
|
|
/**
|
|
|
* Blocking API
|
|
|
- * Derived classes must implement this method to remove the state of RMDelegationToken
|
|
|
+ * Derived classes must implement this method to remove the state of RMDelegationToken.
|
|
|
+ *
|
|
|
+ * @param rmDTIdentifier RMDelegationTokenIdentifier.
|
|
|
+ * @throws Exception error occurs.
|
|
|
*/
|
|
|
protected abstract void removeRMDelegationTokenState(
|
|
|
RMDelegationTokenIdentifier rmDTIdentifier) throws Exception;
|
|
|
|
|
|
/**
|
|
|
* RMDTSecretManager call this to update the state of a delegation token
|
|
|
- * and sequence number
|
|
|
+ * and sequence number.
|
|
|
+ *
|
|
|
+ * @param rmDTIdentifier RMDelegationTokenIdentifier.
|
|
|
+ * @param renewDate token renew date.
|
|
|
*/
|
|
|
public void updateRMDelegationToken(
|
|
|
RMDelegationTokenIdentifier rmDTIdentifier, Long renewDate) {
|
|
@@ -1069,14 +1118,20 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
/**
|
|
|
* Blocking API
|
|
|
* Derived classes must implement this method to update the state of
|
|
|
- * RMDelegationToken and sequence number
|
|
|
+ * RMDelegationToken and sequence number.
|
|
|
+ *
|
|
|
+ * @param rmDTIdentifier RMDelegationTokenIdentifier.
|
|
|
+ * @param renewDate token renew date.
|
|
|
+ * @throws Exception error occurs.
|
|
|
*/
|
|
|
protected abstract void updateRMDelegationTokenState(
|
|
|
RMDelegationTokenIdentifier rmDTIdentifier, Long renewDate)
|
|
|
throws Exception;
|
|
|
|
|
|
/**
|
|
|
- * RMDTSecretManager call this to store the state of a master key
|
|
|
+ * RMDTSecretManager call this to store the state of a master key.
|
|
|
+ *
|
|
|
+ * @param delegationKey DelegationToken Master Key.
|
|
|
*/
|
|
|
public void storeRMDTMasterKey(DelegationKey delegationKey) {
|
|
|
handleStoreEvent(new RMStateStoreRMDTMasterKeyEvent(delegationKey,
|
|
@@ -1086,13 +1141,18 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
/**
|
|
|
* Blocking API
|
|
|
* Derived classes must implement this method to store the state of
|
|
|
- * DelegationToken Master Key
|
|
|
+ * DelegationToken Master Key.
|
|
|
+ *
|
|
|
+ * @param delegationKey DelegationToken Master Key.
|
|
|
+ * @throws Exception error occur.
|
|
|
*/
|
|
|
protected abstract void storeRMDTMasterKeyState(DelegationKey delegationKey)
|
|
|
throws Exception;
|
|
|
|
|
|
/**
|
|
|
- * RMDTSecretManager call this to remove the state of a master key
|
|
|
+ * RMDTSecretManager call this to remove the state of a master key.
|
|
|
+ *
|
|
|
+ * @param delegationKey DelegationToken Master Key.
|
|
|
*/
|
|
|
public void removeRMDTMasterKey(DelegationKey delegationKey) {
|
|
|
handleStoreEvent(new RMStateStoreRMDTMasterKeyEvent(delegationKey,
|
|
@@ -1101,6 +1161,10 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
|
|
|
/**
|
|
|
* Blocking Apis to maintain reservation state.
|
|
|
+ *
|
|
|
+ * @param reservationAllocation reservation Allocation.
|
|
|
+ * @param planName plan Name.
|
|
|
+ * @param reservationIdName reservationId Name.
|
|
|
*/
|
|
|
public void storeNewReservation(
|
|
|
ReservationAllocationStateProto reservationAllocation, String planName,
|
|
@@ -1120,6 +1184,11 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
* Blocking API
|
|
|
* Derived classes must implement this method to store the state of
|
|
|
* a reservation allocation.
|
|
|
+ *
|
|
|
+ * @param reservationAllocation reservation Allocation.
|
|
|
+ * @param planName plan Name.
|
|
|
+ * @param reservationIdName reservationId Name.
|
|
|
+ * @throws Exception error occurs.
|
|
|
*/
|
|
|
protected abstract void storeReservationState(
|
|
|
ReservationAllocationStateProto reservationAllocation, String planName,
|
|
@@ -1129,6 +1198,10 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
* Blocking API
|
|
|
* Derived classes must implement this method to remove the state of
|
|
|
* a reservation allocation.
|
|
|
+ *
|
|
|
+ * @param planName plan Name.
|
|
|
+ * @param reservationIdName reservationId Name.
|
|
|
+ * @throws Exception exception occurs.
|
|
|
*/
|
|
|
protected abstract void removeReservationState(String planName,
|
|
|
String reservationIdName) throws Exception;
|
|
@@ -1136,21 +1209,31 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
/**
|
|
|
* Blocking API
|
|
|
* Derived classes must implement this method to remove the state of
|
|
|
- * DelegationToken Master Key
|
|
|
+ * DelegationToken Master Key.
|
|
|
+ *
|
|
|
+ * @param delegationKey DelegationKey.
|
|
|
+ * @throws Exception exception occurs.
|
|
|
*/
|
|
|
protected abstract void removeRMDTMasterKeyState(DelegationKey delegationKey)
|
|
|
throws Exception;
|
|
|
|
|
|
/**
|
|
|
* Blocking API Derived classes must implement this method to store or update
|
|
|
- * the state of AMRMToken Master Key
|
|
|
+ * the state of AMRMToken Master Key.
|
|
|
+ *
|
|
|
+ * @param amrmTokenSecretManagerState amrmTokenSecretManagerState.
|
|
|
+ * @param isUpdate true, update; otherwise not update.
|
|
|
+ * @throws Exception exception occurs.
|
|
|
*/
|
|
|
protected abstract void storeOrUpdateAMRMTokenSecretManagerState(
|
|
|
AMRMTokenSecretManagerState amrmTokenSecretManagerState, boolean isUpdate)
|
|
|
throws Exception;
|
|
|
|
|
|
/**
|
|
|
- * Store or Update state of AMRMToken Master Key
|
|
|
+ * Store or Update state of AMRMToken Master Key.
|
|
|
+ *
|
|
|
+ * @param amrmTokenSecretManagerState amrmTokenSecretManagerState.
|
|
|
+ * @param isUpdate true, update; otherwise not update.
|
|
|
*/
|
|
|
public void storeOrUpdateAMRMTokenSecretManager(
|
|
|
AMRMTokenSecretManagerState amrmTokenSecretManagerState, boolean isUpdate) {
|
|
@@ -1165,6 +1248,8 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
* store
|
|
|
* This does not block the dispatcher threads
|
|
|
* There is no notification of completion for this operation.
|
|
|
+ *
|
|
|
+ * @param app RMApp.
|
|
|
*/
|
|
|
@SuppressWarnings("unchecked")
|
|
|
public void removeApplication(RMApp app) {
|
|
@@ -1183,7 +1268,10 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
/**
|
|
|
* Blocking API
|
|
|
* Derived classes must implement this method to remove the state of an
|
|
|
- * application and its attempts
|
|
|
+ * application and its attempts.
|
|
|
+ *
|
|
|
+ * @param appState ApplicationStateData.
|
|
|
+ * @throws Exception error occurs.
|
|
|
*/
|
|
|
protected abstract void removeApplicationStateInternal(
|
|
|
ApplicationStateData appState) throws Exception;
|
|
@@ -1194,6 +1282,8 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
* store
|
|
|
* This does not block the dispatcher threads
|
|
|
* There is no notification of completion for this operation.
|
|
|
+ *
|
|
|
+ * @param applicationAttemptId applicationAttemptId.
|
|
|
*/
|
|
|
@SuppressWarnings("unchecked")
|
|
|
public synchronized void removeApplicationAttempt(
|
|
@@ -1206,6 +1296,8 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
* Blocking API
|
|
|
* Derived classes must implement this method to remove the state of specified
|
|
|
* attempt.
|
|
|
+ * @param attemptId application attempt id.
|
|
|
+ * @throws Exception exception occurs.
|
|
|
*/
|
|
|
protected abstract void removeApplicationAttemptInternal(
|
|
|
ApplicationAttemptId attemptId) throws Exception;
|
|
@@ -1316,7 +1408,7 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
|
|
|
/**
|
|
|
* EventHandler implementation which forward events to the FSRMStateStore
|
|
|
- * This hides the EventHandle methods of the store from its public interface
|
|
|
+ * This hides the EventHandle methods of the store from its public interface
|
|
|
*/
|
|
|
private final class ForwardingEventHandler
|
|
|
implements EventHandler<RMStateStoreEvent> {
|
|
@@ -1328,16 +1420,18 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Derived classes must implement this method to delete the state store
|
|
|
- * @throws Exception
|
|
|
+ * Derived classes must implement this method to delete the state store.
|
|
|
+ *
|
|
|
+ * @throws Exception exception occurs.
|
|
|
*/
|
|
|
public abstract void deleteStore() throws Exception;
|
|
|
|
|
|
/**
|
|
|
* Derived classes must implement this method to remove application from the
|
|
|
- * state store
|
|
|
- *
|
|
|
- * @throws Exception
|
|
|
+ * state store.
|
|
|
+ *
|
|
|
+ * @param removeAppId application Id.
|
|
|
+ * @throws Exception exception occurs.
|
|
|
*/
|
|
|
public abstract void removeApplication(ApplicationId removeAppId)
|
|
|
throws Exception;
|
|
@@ -1362,6 +1456,8 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
|
|
|
/**
|
|
|
* ProxyCAManager calls this to store the CA Certificate and Private Key.
|
|
|
+ * @param caCert X509Certificate.
|
|
|
+ * @param caPrivateKey PrivateKey.
|
|
|
*/
|
|
|
public void storeProxyCACert(X509Certificate caCert,
|
|
|
PrivateKey caPrivateKey) {
|
|
@@ -1372,7 +1468,11 @@ public abstract class RMStateStore extends AbstractService {
|
|
|
/**
|
|
|
* Blocking API
|
|
|
* Derived classes must implement this method to store the CA Certificate
|
|
|
- * and Private Key
|
|
|
+ * and Private Key.
|
|
|
+ *
|
|
|
+ * @param caCert X509Certificate.
|
|
|
+ * @param caPrivateKey PrivateKey.
|
|
|
+ * @throws Exception error occurs.
|
|
|
*/
|
|
|
protected abstract void storeProxyCACertState(
|
|
|
X509Certificate caCert, PrivateKey caPrivateKey) throws Exception;
|