hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asur...@apache.org
Subject hadoop git commit: YARN-4184. Remove update reservation state api from state store as its not used by ReservationSystem (Sean Po via asuresh)
Date Tue, 17 Nov 2015 23:52:13 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 0f9f9ba3c -> d8e60080e


YARN-4184. Remove update reservation state api from state store as its not used by ReservationSystem
(Sean Po via asuresh)

(cherry picked from commit 6a61928fb790d553c942641761ea963b5e996ef6)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/d8e60080
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/d8e60080
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/d8e60080

Branch: refs/heads/branch-2
Commit: d8e60080e91370445a5fccad8cca77b43ce63e7d
Parents: 0f9f9ba
Author: Arun Suresh <asuresh@apache.org>
Authored: Tue Nov 17 15:50:34 2015 -0800
Committer: Arun Suresh <asuresh@apache.org>
Committed: Tue Nov 17 15:51:59 2015 -0800

----------------------------------------------------------------------
 hadoop-yarn-project/CHANGES.txt                 |  3 ++
 .../recovery/FileSystemRMStateStore.java        | 12 -----
 .../recovery/LeveldbRMStateStore.java           |  8 ---
 .../recovery/MemoryRMStateStore.java            | 17 -------
 .../recovery/NullRMStateStore.java              | 10 ----
 .../resourcemanager/recovery/RMStateStore.java  | 51 --------------------
 .../recovery/RMStateStoreEventType.java         |  1 -
 .../recovery/ZKRMStateStore.java                | 11 -----
 .../recovery/RMStateStoreTestBase.java          |  5 +-
 9 files changed, 5 insertions(+), 113 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/d8e60080/hadoop-yarn-project/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt
index 65c2afa..3f8b330 100644
--- a/hadoop-yarn-project/CHANGES.txt
+++ b/hadoop-yarn-project/CHANGES.txt
@@ -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

http://git-wip-us.apache.org/repos/asf/hadoop/blob/d8e60080/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/FileSystemRMStateStore.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/FileSystemRMStateStore.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/FileSystemRMStateStore.java
index f02fe78..a1cebf5 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/FileSystemRMStateStore.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/FileSystemRMStateStore.java
@@ -866,18 +866,6 @@ public class FileSystemRMStateStore extends RMStateStore {
   }
 
   @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 {
     Path planCreatePath = getNodePath(reservationRoot, planName);

http://git-wip-us.apache.org/repos/asf/hadoop/blob/d8e60080/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/LeveldbRMStateStore.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/LeveldbRMStateStore.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/LeveldbRMStateStore.java
index faaadb8..afc6721 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/LeveldbRMStateStore.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/LeveldbRMStateStore.java
@@ -624,14 +624,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 {
     try {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/d8e60080/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/MemoryRMStateStore.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/MemoryRMStateStore.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/MemoryRMStateStore.java
index b4f8805..ce6addb 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/MemoryRMStateStore.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/MemoryRMStateStore.java
@@ -244,23 +244,6 @@ public class MemoryRMStateStore extends RMStateStore {
   }
 
   @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 {
     LOG.info("Removing reservationallocation " + reservationIdName

http://git-wip-us.apache.org/repos/asf/hadoop/blob/d8e60080/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/NullRMStateStore.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/NullRMStateStore.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/NullRMStateStore.java
index ffb6153..96f77f5 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/NullRMStateStore.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/NullRMStateStore.java
@@ -116,13 +116,6 @@ public class NullRMStateStore extends RMStateStore {
   }
 
   @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
   }
-
-
-
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/d8e60080/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/RMStateStore.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/RMStateStore.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/RMStateStore.java
index a2cf517..9a2e02a 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/RMStateStore.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/RMStateStore.java
@@ -164,10 +164,6 @@ public abstract class RMStateStore extends AbstractService {
           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,
           new RemoveReservationAllocationTransition())
       .addTransition(RMStateStoreState.ACTIVE, RMStateStoreState.FENCED,
@@ -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,
@@ -972,15 +930,6 @@ public abstract class RMStateStore extends AbstractService {
 
   /**
    * 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
    * DelegationToken Master Key
    */

http://git-wip-us.apache.org/repos/asf/hadoop/blob/d8e60080/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/RMStateStoreEventType.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/RMStateStoreEventType.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/RMStateStoreEventType.java
index 6f8dca7..492826d 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/RMStateStoreEventType.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/RMStateStoreEventType.java
@@ -34,6 +34,5 @@ public enum RMStateStoreEventType {
   UPDATE_DELEGATION_TOKEN,
   UPDATE_AMRM_TOKEN,
   STORE_RESERVATION,
-  UPDATE_RESERVATION,
   REMOVE_RESERVATION,
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/d8e60080/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/ZKRMStateStore.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/ZKRMStateStore.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/ZKRMStateStore.java
index a86b60c..ca0f4ac 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/ZKRMStateStore.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/ZKRMStateStore.java
@@ -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)

http://git-wip-us.apache.org/repos/asf/hadoop/blob/d8e60080/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/RMStateStoreTestBase.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/RMStateStoreTestBase.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/RMStateStoreTestBase.java
index 7b05af3..175f31f 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/RMStateStoreTestBase.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/RMStateStoreTestBase.java
@@ -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(


Mime
View raw message