YARN-4184. Remove update reservation state api from state store as its not used by ReservationSystem (Sean Po via asuresh)
(cherry picked from commit 6a61928fb7
)
This commit is contained in:
parent
0f9f9ba3cb
commit
d8e60080e9
|
@ -195,6 +195,9 @@ Release 2.8.0 - UNRELEASED
|
|||
YARN-1509. Make AMRMClient support send increase container request and
|
||||
get increased/decreased containers. (Meng Ding via wangda)
|
||||
|
||||
YARN-4184. Remove update reservation state api from state store as its not used by
|
||||
ReservationSystem (Sean Po via asuresh)
|
||||
|
||||
IMPROVEMENTS
|
||||
|
||||
YARN-644. Basic null check is not performed on passed in arguments before
|
||||
|
|
|
@ -865,18 +865,6 @@ public class FileSystemRMStateStore extends RMStateStore {
|
|||
writeFileWithRetries(reservationPath, reservationData, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateReservationState(
|
||||
ReservationAllocationStateProto reservationAllocation, String planName,
|
||||
String reservationIdName) throws Exception {
|
||||
Path planCreatePath = getNodePath(reservationRoot, planName);
|
||||
Path reservationPath = getNodePath(planCreatePath, reservationIdName);
|
||||
LOG.info("Updating state for reservation " + reservationIdName + " from " +
|
||||
"plan " + planName + " at path " + reservationPath);
|
||||
byte[] reservationData = reservationAllocation.toByteArray();
|
||||
updateFile(reservationPath, reservationData, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void removeReservationState(
|
||||
String planName, String reservationIdName) throws Exception {
|
||||
|
|
|
@ -623,14 +623,6 @@ public class LeveldbRMStateStore extends RMStateStore {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateReservationState(
|
||||
ReservationAllocationStateProto reservationAllocation, String planName,
|
||||
String reservationIdName) throws Exception {
|
||||
storeReservationState(reservationAllocation, planName,
|
||||
reservationIdName);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void removeReservationState(String planName,
|
||||
String reservationIdName) throws Exception {
|
||||
|
|
|
@ -243,23 +243,6 @@ public class MemoryRMStateStore extends RMStateStore {
|
|||
planState.put(reservationId, reservationAllocation);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected synchronized void updateReservationState(
|
||||
ReservationAllocationStateProto reservationAllocation, String planName,
|
||||
String reservationIdName) throws Exception {
|
||||
LOG.info("Updating reservationallocation for " + reservationIdName + " " +
|
||||
"for plan " + planName);
|
||||
Map<ReservationId, ReservationAllocationStateProto> planState =
|
||||
state.getReservationState().get(planName);
|
||||
if (planState == null) {
|
||||
throw new YarnRuntimeException("State for plan " + planName + " does " +
|
||||
"not exist");
|
||||
}
|
||||
ReservationId reservationId =
|
||||
ReservationId.parseReservationId(reservationIdName);
|
||||
planState.put(reservationId, reservationAllocation);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected synchronized void removeReservationState(
|
||||
String planName, String reservationIdName) throws Exception {
|
||||
|
|
|
@ -115,13 +115,6 @@ public class NullRMStateStore extends RMStateStore {
|
|||
// Do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateReservationState(
|
||||
ReservationAllocationStateProto reservationAllocation, String planName,
|
||||
String reservationIdName) throws Exception {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeRMDTMasterKeyState(DelegationKey delegationKey) throws Exception {
|
||||
// Do nothing
|
||||
|
@ -175,7 +168,4 @@ public class NullRMStateStore extends RMStateStore {
|
|||
public void removeApplication(ApplicationId removeAppId) throws Exception {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -162,10 +162,6 @@ public abstract class RMStateStore extends AbstractService {
|
|||
EnumSet.of(RMStateStoreState.ACTIVE, RMStateStoreState.FENCED),
|
||||
RMStateStoreEventType.STORE_RESERVATION,
|
||||
new StoreReservationAllocationTransition())
|
||||
.addTransition(RMStateStoreState.ACTIVE,
|
||||
EnumSet.of(RMStateStoreState.ACTIVE, RMStateStoreState.FENCED),
|
||||
RMStateStoreEventType.UPDATE_RESERVATION,
|
||||
new UpdateReservationAllocationTransition())
|
||||
.addTransition(RMStateStoreState.ACTIVE,
|
||||
EnumSet.of(RMStateStoreState.ACTIVE, RMStateStoreState.FENCED),
|
||||
RMStateStoreEventType.REMOVE_RESERVATION,
|
||||
|
@ -187,7 +183,6 @@ public abstract class RMStateStore extends AbstractService {
|
|||
RMStateStoreEventType.UPDATE_DELEGATION_TOKEN,
|
||||
RMStateStoreEventType.UPDATE_AMRM_TOKEN,
|
||||
RMStateStoreEventType.STORE_RESERVATION,
|
||||
RMStateStoreEventType.UPDATE_RESERVATION,
|
||||
RMStateStoreEventType.REMOVE_RESERVATION));
|
||||
|
||||
private final StateMachine<RMStateStoreState,
|
||||
|
@ -524,35 +519,6 @@ public abstract class RMStateStore extends AbstractService {
|
|||
}
|
||||
}
|
||||
|
||||
private static class UpdateReservationAllocationTransition implements
|
||||
MultipleArcTransition<RMStateStore, RMStateStoreEvent,
|
||||
RMStateStoreState> {
|
||||
@Override
|
||||
public RMStateStoreState transition(RMStateStore store,
|
||||
RMStateStoreEvent event) {
|
||||
if (!(event instanceof RMStateStoreStoreReservationEvent)) {
|
||||
// should never happen
|
||||
LOG.error("Illegal event type: " + event.getClass());
|
||||
return RMStateStoreState.ACTIVE;
|
||||
}
|
||||
boolean isFenced = false;
|
||||
RMStateStoreStoreReservationEvent reservationEvent =
|
||||
(RMStateStoreStoreReservationEvent) event;
|
||||
try {
|
||||
LOG.info("Updating reservation allocation." + reservationEvent
|
||||
.getReservationIdName());
|
||||
store.updateReservationState(
|
||||
reservationEvent.getReservationAllocation(),
|
||||
reservationEvent.getPlanName(),
|
||||
reservationEvent.getReservationIdName());
|
||||
} catch (Exception e) {
|
||||
LOG.error("Error while updating reservation allocation.", e);
|
||||
isFenced = store.notifyStoreOperationFailedInternal(e);
|
||||
}
|
||||
return finalState(isFenced);
|
||||
}
|
||||
}
|
||||
|
||||
private static class RemoveReservationAllocationTransition implements
|
||||
MultipleArcTransition<RMStateStore, RMStateStoreEvent,
|
||||
RMStateStoreState> {
|
||||
|
@ -939,14 +905,6 @@ public abstract class RMStateStore extends AbstractService {
|
|||
planName, reservationIdName));
|
||||
}
|
||||
|
||||
public void updateReservation(
|
||||
ReservationAllocationStateProto reservationAllocation,
|
||||
String planName, String reservationIdName) {
|
||||
handleStoreEvent(new RMStateStoreStoreReservationEvent(
|
||||
reservationAllocation, RMStateStoreEventType.UPDATE_RESERVATION,
|
||||
planName, reservationIdName));
|
||||
}
|
||||
|
||||
public void removeReservation(String planName, String reservationIdName) {
|
||||
handleStoreEvent(new RMStateStoreStoreReservationEvent(
|
||||
null, RMStateStoreEventType.REMOVE_RESERVATION,
|
||||
|
@ -970,15 +928,6 @@ public abstract class RMStateStore extends AbstractService {
|
|||
protected abstract void removeReservationState(String planName,
|
||||
String reservationIdName) throws Exception;
|
||||
|
||||
/**
|
||||
* Blocking API
|
||||
* Derived classes must implement this method to update the state of
|
||||
* a reservation allocation.
|
||||
*/
|
||||
protected abstract void updateReservationState(
|
||||
ReservationAllocationStateProto reservationAllocation, String planName,
|
||||
String reservationIdName) throws Exception;
|
||||
|
||||
/**
|
||||
* Blocking API
|
||||
* Derived classes must implement this method to remove the state of
|
||||
|
|
|
@ -34,6 +34,5 @@ public enum RMStateStoreEventType {
|
|||
UPDATE_DELEGATION_TOKEN,
|
||||
UPDATE_AMRM_TOKEN,
|
||||
STORE_RESERVATION,
|
||||
UPDATE_RESERVATION,
|
||||
REMOVE_RESERVATION,
|
||||
}
|
||||
|
|
|
@ -845,17 +845,6 @@ public class ZKRMStateStore extends RMStateStore {
|
|||
trx.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected synchronized void updateReservationState(
|
||||
ReservationAllocationStateProto reservationAllocation, String planName,
|
||||
String reservationIdName)
|
||||
throws Exception {
|
||||
SafeTransaction trx = new SafeTransaction();
|
||||
addOrUpdateReservationState(
|
||||
reservationAllocation, planName, reservationIdName, trx, true);
|
||||
trx.commit();
|
||||
}
|
||||
|
||||
private void addOrUpdateReservationState(
|
||||
ReservationAllocationStateProto reservationAllocation, String planName,
|
||||
String reservationIdName, SafeTransaction trx, boolean isUpdate)
|
||||
|
|
|
@ -760,9 +760,8 @@ public class RMStateStoreTestBase {
|
|||
minAlloc, hasGang);
|
||||
allocationStateProto =
|
||||
ReservationSystemUtil.buildStateProto(allocation);
|
||||
rmContext.getStateStore().updateReservation(
|
||||
allocationStateProto,
|
||||
planName, reservationIdName);
|
||||
rmContext.getStateStore().removeReservation(planName, reservationIdName);
|
||||
rmContext.getStateStore().storeNewReservation(allocationStateProto, planName, reservationIdName);
|
||||
|
||||
// load state and verify updated reservation
|
||||
validateStoredReservation(
|
||||
|
|
Loading…
Reference in New Issue