You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by vi...@apache.org on 2015/05/07 02:59:04 UTC

[1/3] hadoop git commit: YARN-3469. ZKRMStateStore: Avoid setting watches that are not required. (Jun Hong via kasha)

Repository: hadoop
Updated Branches:
  refs/heads/branch-2.7 4e8e9d717 -> 3d1d551c3


YARN-3469. ZKRMStateStore: Avoid setting watches that are not required. (Jun Hong via kasha)

(cherry picked from commit e516706b896743e47e2852be81944eb5613e3e76)


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

Branch: refs/heads/branch-2.7
Commit: fbd4bbb07bd995c8e871fca59bc40df02f555e0e
Parents: 4e8e9d7
Author: Karthik Kambatla <ka...@apache.org>
Authored: Fri Apr 10 11:20:34 2015 -0700
Committer: Vinod Kumar Vavilapalli <vi...@apache.org>
Committed: Wed May 6 17:57:13 2015 -0700

----------------------------------------------------------------------
 hadoop-yarn-project/CHANGES.txt                 |  3 ++
 .../recovery/ZKRMStateStore.java                | 40 ++++++++++----------
 2 files changed, 23 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/fbd4bbb0/hadoop-yarn-project/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt
index 7a178be..4d3fc53 100644
--- a/hadoop-yarn-project/CHANGES.txt
+++ b/hadoop-yarn-project/CHANGES.txt
@@ -16,6 +16,9 @@ Release 2.7.1 - UNRELEASED
     YARN-3006. Improve the error message when attempting manual failover with 
     auto-failover enabled. (Akira AJISAKA via wangda)
 
+    YARN-3469. ZKRMStateStore: Avoid setting watches that are not required. 
+    (Jun Hong via kasha)
+
   BUG FIXES
 
     YARN-3487. CapacityScheduler scheduler lock obtained unnecessarily when 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/fbd4bbb0/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 614ef15..e8891a2 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
@@ -391,7 +391,7 @@ public class ZKRMStateStore extends RMStateStore {
     String versionNodePath = getNodePath(zkRootNodePath, VERSION_NODE);
     byte[] data =
         ((VersionPBImpl) CURRENT_VERSION_INFO).getProto().toByteArray();
-    if (existsWithRetries(versionNodePath, true) != null) {
+    if (existsWithRetries(versionNodePath, false) != null) {
       setDataWithRetries(versionNodePath, data, -1);
     } else {
       createWithRetries(versionNodePath, data, zkAcl, CreateMode.PERSISTENT);
@@ -402,8 +402,8 @@ public class ZKRMStateStore extends RMStateStore {
   protected synchronized Version loadVersion() throws Exception {
     String versionNodePath = getNodePath(zkRootNodePath, VERSION_NODE);
 
-    if (existsWithRetries(versionNodePath, true) != null) {
-      byte[] data = getDataWithRetries(versionNodePath, true);
+    if (existsWithRetries(versionNodePath, false) != null) {
+      byte[] data = getDataWithRetries(versionNodePath, false);
       Version version =
           new VersionPBImpl(VersionProto.parseFrom(data));
       return version;
@@ -415,9 +415,9 @@ public class ZKRMStateStore extends RMStateStore {
   public synchronized long getAndIncrementEpoch() throws Exception {
     String epochNodePath = getNodePath(zkRootNodePath, EPOCH_NODE);
     long currentEpoch = 0;
-    if (existsWithRetries(epochNodePath, true) != null) {
+    if (existsWithRetries(epochNodePath, false) != null) {
       // load current epoch
-      byte[] data = getDataWithRetries(epochNodePath, true);
+      byte[] data = getDataWithRetries(epochNodePath, false);
       Epoch epoch = new EpochPBImpl(EpochProto.parseFrom(data));
       currentEpoch = epoch.getEpoch();
       // increment epoch and store it
@@ -447,7 +447,7 @@ public class ZKRMStateStore extends RMStateStore {
 
   private void loadAMRMTokenSecretManagerState(RMState rmState)
       throws Exception {
-    byte[] data = getDataWithRetries(amrmTokenSecretManagerRoot, true);
+    byte[] data = getDataWithRetries(amrmTokenSecretManagerRoot, false);
     if (data == null) {
       LOG.warn("There is no data saved");
       return;
@@ -470,10 +470,10 @@ public class ZKRMStateStore extends RMStateStore {
 
   private void loadRMDelegationKeyState(RMState rmState) throws Exception {
     List<String> childNodes =
-        getChildrenWithRetries(dtMasterKeysRootPath, true);
+        getChildrenWithRetries(dtMasterKeysRootPath, false);
     for (String childNodeName : childNodes) {
       String childNodePath = getNodePath(dtMasterKeysRootPath, childNodeName);
-      byte[] childData = getDataWithRetries(childNodePath, true);
+      byte[] childData = getDataWithRetries(childNodePath, false);
 
       if (childData == null) {
         LOG.warn("Content of " + childNodePath + " is broken.");
@@ -515,11 +515,11 @@ public class ZKRMStateStore extends RMStateStore {
 
   private void loadRMDelegationTokenState(RMState rmState) throws Exception {
     List<String> childNodes =
-        getChildrenWithRetries(delegationTokensRootPath, true);
+        getChildrenWithRetries(delegationTokensRootPath, false);
     for (String childNodeName : childNodes) {
       String childNodePath =
           getNodePath(delegationTokensRootPath, childNodeName);
-      byte[] childData = getDataWithRetries(childNodePath, true);
+      byte[] childData = getDataWithRetries(childNodePath, false);
 
       if (childData == null) {
         LOG.warn("Content of " + childNodePath + " is broken.");
@@ -551,10 +551,10 @@ public class ZKRMStateStore extends RMStateStore {
   }
 
   private synchronized void loadRMAppState(RMState rmState) throws Exception {
-    List<String> childNodes = getChildrenWithRetries(rmAppRoot, true);
+    List<String> childNodes = getChildrenWithRetries(rmAppRoot, false);
     for (String childNodeName : childNodes) {
       String childNodePath = getNodePath(rmAppRoot, childNodeName);
-      byte[] childData = getDataWithRetries(childNodePath, true);
+      byte[] childData = getDataWithRetries(childNodePath, false);
       if (childNodeName.startsWith(ApplicationId.appIdStrPrefix)) {
         // application
         if (LOG.isDebugEnabled()) {
@@ -585,7 +585,7 @@ public class ZKRMStateStore extends RMStateStore {
     for (String attemptIDStr : attempts) {
       if (attemptIDStr.startsWith(ApplicationAttemptId.appAttemptIdStrPrefix)) {
         String attemptPath = getNodePath(appPath, attemptIDStr);
-        byte[] attemptData = getDataWithRetries(attemptPath, true);
+        byte[] attemptData = getDataWithRetries(attemptPath, false);
 
         ApplicationAttemptStateDataPBImpl attemptState =
             new ApplicationAttemptStateDataPBImpl(
@@ -622,7 +622,7 @@ public class ZKRMStateStore extends RMStateStore {
     }
     byte[] appStateData = appStateDataPB.getProto().toByteArray();
 
-    if (existsWithRetries(nodeUpdatePath, true) != null) {
+    if (existsWithRetries(nodeUpdatePath, false) != null) {
       setDataWithRetries(nodeUpdatePath, appStateData, -1);
     } else {
       createWithRetries(nodeUpdatePath, appStateData, zkAcl,
@@ -665,7 +665,7 @@ public class ZKRMStateStore extends RMStateStore {
     }
     byte[] attemptStateData = attemptStateDataPB.getProto().toByteArray();
 
-    if (existsWithRetries(nodeUpdatePath, true) != null) {
+    if (existsWithRetries(nodeUpdatePath, false) != null) {
       setDataWithRetries(nodeUpdatePath, attemptStateData, -1);
     } else {
       createWithRetries(nodeUpdatePath, attemptStateData, zkAcl,
@@ -717,7 +717,7 @@ public class ZKRMStateStore extends RMStateStore {
       LOG.debug("Removing RMDelegationToken_"
           + rmDTIdentifier.getSequenceNumber());
     }
-    if (existsWithRetries(nodeRemovePath, true) != null) {
+    if (existsWithRetries(nodeRemovePath, false) != null) {
       opList.add(Op.delete(nodeRemovePath, -1));
     } else {
       LOG.debug("Attempted to delete a non-existing znode " + nodeRemovePath);
@@ -733,7 +733,7 @@ public class ZKRMStateStore extends RMStateStore {
     String nodeRemovePath =
         getNodePath(delegationTokensRootPath, DELEGATION_TOKEN_PREFIX
             + rmDTIdentifier.getSequenceNumber());
-    if (existsWithRetries(nodeRemovePath, true) == null) {
+    if (existsWithRetries(nodeRemovePath, false) == null) {
       // in case znode doesn't exist
       addStoreOrUpdateOps(opList, rmDTIdentifier, renewDate, false);
       LOG.debug("Attempted to update a non-existing znode " + nodeRemovePath);
@@ -809,7 +809,7 @@ public class ZKRMStateStore extends RMStateStore {
     if (LOG.isDebugEnabled()) {
       LOG.debug("Removing RMDelegationKey_" + delegationKey.getKeyId());
     }
-    if (existsWithRetries(nodeRemovePath, true) != null) {
+    if (existsWithRetries(nodeRemovePath, false) != null) {
       doMultiWithRetries(Op.delete(nodeRemovePath, -1));
     } else {
       LOG.debug("Attempted to delete a non-existing znode " + nodeRemovePath);
@@ -818,8 +818,8 @@ public class ZKRMStateStore extends RMStateStore {
 
   @Override
   public synchronized void deleteStore() throws Exception {
-    if (existsWithRetries(zkRootNodePath, true) != null) {
-      deleteWithRetries(zkRootNodePath, true);
+    if (existsWithRetries(zkRootNodePath, false) != null) {
+      deleteWithRetries(zkRootNodePath, false);
     }
   }
 


[3/3] hadoop git commit: YARN-3385. Fixed a race-condition in ResourceManager's ZooKeeper based state-store to avoid crashing on duplicate deletes. Contributed by Zhihai Xu.

Posted by vi...@apache.org.
YARN-3385. Fixed a race-condition in ResourceManager's ZooKeeper based state-store to avoid crashing on duplicate deletes. Contributed by Zhihai Xu.

(cherry picked from commit 4c7b9b6abe2452c9752a11214762be2e7665fb32)


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

Branch: refs/heads/branch-2.7
Commit: 3d1d551c33ffd84cf6b9acfccce47daa1271b644
Parents: 419b8f6
Author: Vinod Kumar Vavilapalli <vi...@apache.org>
Authored: Wed May 6 17:51:17 2015 -0700
Committer: Vinod Kumar Vavilapalli <vi...@apache.org>
Committed: Wed May 6 17:57:49 2015 -0700

----------------------------------------------------------------------
 hadoop-yarn-project/CHANGES.txt                 |  3 +
 .../recovery/ZKRMStateStore.java                | 64 ++++++++++++++++----
 .../recovery/TestZKRMStateStore.java            | 35 +++++++++++
 3 files changed, 89 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/3d1d551c/hadoop-yarn-project/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt
index c2430c2..0229c29 100644
--- a/hadoop-yarn-project/CHANGES.txt
+++ b/hadoop-yarn-project/CHANGES.txt
@@ -62,6 +62,9 @@ Release 2.7.1 - UNRELEASED
     YARN-3301. Fixed the format issue of the new RM attempt web page.
     (Xuan Gong via jianhe)
 
+    YARN-3385. Fixed a race-condition in ResourceManager's ZooKeeper based
+    state-store to avoid crashing on duplicate deletes. (Zhihai Xu via vinodkv)
+
 Release 2.7.0 - 2015-04-20
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/3d1d551c/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 e8891a2..a116e06 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
@@ -694,7 +694,7 @@ public class ZKRMStateStore extends RMStateStore {
       LOG.debug("Removing info for app: " + appId + " at: " + appIdRemovePath
           + " and its attempts.");
     }
-    doMultiWithRetries(opList);
+    doDeleteMultiWithRetries(opList);
   }
 
   @Override
@@ -703,13 +703,12 @@ public class ZKRMStateStore extends RMStateStore {
       throws Exception {
     ArrayList<Op> opList = new ArrayList<Op>();
     addStoreOrUpdateOps(opList, rmDTIdentifier, renewDate, false);
-    doMultiWithRetries(opList);
+    doStoreMultiWithRetries(opList);
   }
 
   @Override
   protected synchronized void removeRMDelegationTokenState(
       RMDelegationTokenIdentifier rmDTIdentifier) throws Exception {
-    ArrayList<Op> opList = new ArrayList<Op>();
     String nodeRemovePath =
         getNodePath(delegationTokensRootPath, DELEGATION_TOKEN_PREFIX
             + rmDTIdentifier.getSequenceNumber());
@@ -718,11 +717,12 @@ public class ZKRMStateStore extends RMStateStore {
           + rmDTIdentifier.getSequenceNumber());
     }
     if (existsWithRetries(nodeRemovePath, false) != null) {
+      ArrayList<Op> opList = new ArrayList<Op>();
       opList.add(Op.delete(nodeRemovePath, -1));
+      doDeleteMultiWithRetries(opList);
     } else {
       LOG.debug("Attempted to delete a non-existing znode " + nodeRemovePath);
     }
-    doMultiWithRetries(opList);
   }
 
   @Override
@@ -741,7 +741,7 @@ public class ZKRMStateStore extends RMStateStore {
       // in case znode exists
       addStoreOrUpdateOps(opList, rmDTIdentifier, renewDate, true);
     }
-    doMultiWithRetries(opList);
+    doStoreMultiWithRetries(opList);
   }
 
   private void addStoreOrUpdateOps(ArrayList<Op> opList,
@@ -810,7 +810,7 @@ public class ZKRMStateStore extends RMStateStore {
       LOG.debug("Removing RMDelegationKey_" + delegationKey.getKeyId());
     }
     if (existsWithRetries(nodeRemovePath, false) != null) {
-      doMultiWithRetries(Op.delete(nodeRemovePath, -1));
+      doDeleteMultiWithRetries(Op.delete(nodeRemovePath, -1));
     } else {
       LOG.debug("Attempted to delete a non-existing znode " + nodeRemovePath);
     }
@@ -905,7 +905,7 @@ public class ZKRMStateStore extends RMStateStore {
    * Helper method that creates fencing node, executes the passed operations,
    * and deletes the fencing node.
    */
-  private synchronized void doMultiWithRetries(
+  private synchronized void doStoreMultiWithRetries(
       final List<Op> opList) throws Exception {
     final List<Op> execOpList = new ArrayList<Op>(opList.size() + 2);
     execOpList.add(createFencingNodePathOp);
@@ -924,8 +924,32 @@ public class ZKRMStateStore extends RMStateStore {
    * Helper method that creates fencing node, executes the passed operation,
    * and deletes the fencing node.
    */
-  private void doMultiWithRetries(final Op op) throws Exception {
-    doMultiWithRetries(Collections.singletonList(op));
+  private void doStoreMultiWithRetries(final Op op) throws Exception {
+    doStoreMultiWithRetries(Collections.singletonList(op));
+  }
+
+  /**
+   * Helper method that creates fencing node, executes the passed
+   * delete related operations and deletes the fencing node.
+   */
+  private synchronized void doDeleteMultiWithRetries(
+      final List<Op> opList) throws Exception {
+    final List<Op> execOpList = new ArrayList<Op>(opList.size() + 2);
+    execOpList.add(createFencingNodePathOp);
+    execOpList.addAll(opList);
+    execOpList.add(deleteFencingNodePathOp);
+    new ZKAction<Void>() {
+      @Override
+      public Void run() throws KeeperException, InterruptedException {
+        setHasDeleteNodeOp(true);
+        zkClient.multi(execOpList);
+        return null;
+      }
+    }.runWithRetries();
+  }
+
+  private void doDeleteMultiWithRetries(final Op op) throws Exception {
+    doDeleteMultiWithRetries(Collections.singletonList(op));
   }
 
   @VisibleForTesting
@@ -934,7 +958,7 @@ public class ZKRMStateStore extends RMStateStore {
   public void createWithRetries(
       final String path, final byte[] data, final List<ACL> acl,
       final CreateMode mode) throws Exception {
-    doMultiWithRetries(Op.create(path, data, acl, mode));
+    doStoreMultiWithRetries(Op.create(path, data, acl, mode));
   }
 
   @VisibleForTesting
@@ -942,7 +966,7 @@ public class ZKRMStateStore extends RMStateStore {
   @Unstable
   public void setDataWithRetries(final String path, final byte[] data,
                                  final int version) throws Exception {
-    doMultiWithRetries(Op.setData(path, data, version));
+    doStoreMultiWithRetries(Op.setData(path, data, version));
   }
 
   @VisibleForTesting
@@ -1008,7 +1032,12 @@ public class ZKRMStateStore extends RMStateStore {
     for (String child : children) {
       recursiveDeleteWithRetriesHelper(path + "/" + child, false);
     }
-    zkClient.delete(path, -1);
+
+    try {
+      zkClient.delete(path, -1);
+    } catch (KeeperException.NoNodeException nne) {
+      LOG.info("Node " + path + " doesn't exist to delete");
+    }
   }
 
   /**
@@ -1028,7 +1057,7 @@ public class ZKRMStateStore extends RMStateStore {
           if(isFencedState()) { 
             break;
           }
-          doMultiWithRetries(emptyOpList);
+          doStoreMultiWithRetries(emptyOpList);
           Thread.sleep(zkSessionTimeout);
         }
       } catch (InterruptedException ie) {
@@ -1041,6 +1070,10 @@ public class ZKRMStateStore extends RMStateStore {
   }
 
   private abstract class ZKAction<T> {
+    private boolean hasDeleteNodeOp = false;
+    void setHasDeleteNodeOp(boolean hasDeleteOp) {
+      this.hasDeleteNodeOp = hasDeleteOp;
+    }
     // run() expects synchronization on ZKRMStateStore.this
     abstract T run() throws KeeperException, InterruptedException;
 
@@ -1090,6 +1123,11 @@ public class ZKRMStateStore extends RMStateStore {
             LOG.info("znode already exists!");
             return null;
           }
+          if (hasDeleteNodeOp && ke.code() == Code.NONODE) {
+            LOG.info("znode has already been deleted!");
+            return null;
+          }
+
           LOG.info("Exception while executing a ZK operation.", ke);
           if (shouldRetry(ke.code()) && ++retry < numRetries) {
             LOG.info("Retrying operation on ZK. Retry no. " + retry);

http://git-wip-us.apache.org/repos/asf/hadoop/blob/3d1d551c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/TestZKRMStateStore.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/TestZKRMStateStore.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/TestZKRMStateStore.java
index bbbf5a1..991c35f 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/TestZKRMStateStore.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/TestZKRMStateStore.java
@@ -24,6 +24,7 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
 import java.io.IOException;
+import java.util.HashMap;
 import java.util.List;
 
 import javax.crypto.SecretKey;
@@ -37,6 +38,7 @@ import org.apache.hadoop.io.Text;
 import org.apache.hadoop.security.token.delegation.DelegationKey;
 import org.apache.hadoop.service.Service;
 import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
+import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
 import org.apache.hadoop.yarn.api.records.Container;
 import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
@@ -57,6 +59,7 @@ import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptM
 import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptState;
 import org.apache.hadoop.yarn.server.resourcemanager.security.ClientToAMTokenSecretManagerInRM;
 import org.apache.hadoop.yarn.util.ConverterUtils;
+import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.ZooKeeper;
 import org.apache.zookeeper.data.Stat;
 import org.junit.Assert;
@@ -370,4 +373,36 @@ public class TestZKRMStateStore extends RMStateStoreTestBase {
 
     store.close();
   }
+
+  @Test
+  public void testDuplicateRMAppDeletion() throws Exception {
+    TestZKRMStateStoreTester zkTester = new TestZKRMStateStoreTester();
+    long submitTime = System.currentTimeMillis();
+    long startTime = System.currentTimeMillis() + 1234;
+    RMStateStore store = zkTester.getRMStateStore();
+    TestDispatcher dispatcher = new TestDispatcher();
+    store.setRMDispatcher(dispatcher);
+
+    ApplicationAttemptId attemptIdRemoved = ConverterUtils
+        .toApplicationAttemptId("appattempt_1352994193343_0002_000001");
+    ApplicationId appIdRemoved = attemptIdRemoved.getApplicationId();
+    storeApp(store, appIdRemoved, submitTime, startTime);
+    storeAttempt(store, attemptIdRemoved,
+        "container_1352994193343_0002_01_000001", null, null, dispatcher);
+
+    ApplicationSubmissionContext context =
+        new ApplicationSubmissionContextPBImpl();
+    context.setApplicationId(appIdRemoved);
+    ApplicationStateData appStateRemoved =
+        ApplicationStateData.newInstance(
+            submitTime, startTime, context, "user1");
+    appStateRemoved.attempts.put(attemptIdRemoved, null);
+    store.removeApplicationStateInternal(appStateRemoved);
+    try {
+      store.removeApplicationStateInternal(appStateRemoved);
+    } catch (KeeperException.NoNodeException nne) {
+      Assert.fail("NoNodeException should not happen.");
+    }
+    store.close();
+  }
 }


[2/3] hadoop git commit: Fix up author name to Jun Gong in CHANGES.txt for YARN-3469

Posted by vi...@apache.org.
Fix up author name to Jun Gong in CHANGES.txt for YARN-3469

(cherry picked from commit 5cda6fffd39fcb997b6e3cbcd0a2e2dce07153e1)


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

Branch: refs/heads/branch-2.7
Commit: 419b8f68f44f3b3544c46703225f845106d7d77e
Parents: fbd4bbb
Author: Karthik Kambatla <ka...@apache.org>
Authored: Mon Apr 13 13:52:28 2015 -0700
Committer: Vinod Kumar Vavilapalli <vi...@apache.org>
Committed: Wed May 6 17:57:36 2015 -0700

----------------------------------------------------------------------
 hadoop-yarn-project/CHANGES.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/419b8f68/hadoop-yarn-project/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt
index 4d3fc53..c2430c2 100644
--- a/hadoop-yarn-project/CHANGES.txt
+++ b/hadoop-yarn-project/CHANGES.txt
@@ -17,7 +17,7 @@ Release 2.7.1 - UNRELEASED
     auto-failover enabled. (Akira AJISAKA via wangda)
 
     YARN-3469. ZKRMStateStore: Avoid setting watches that are not required. 
-    (Jun Hong via kasha)
+    (Jun Gong via kasha)
 
   BUG FIXES