[05/22] git commit: HDFS-7059. HAadmin transtionToActive with forceActive option can show confusing message. Contributed by Rushabh Shah.

2014-09-16 Thread jing9
HDFS-7059. HAadmin transtionToActive with forceActive option can show
confusing message. Contributed by Rushabh Shah.


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

Branch: refs/heads/HDFS-6584
Commit: 2f847b3357448184aaec935052f34d116ad3a42c
Parents: 0c8aec4
Author: Kihwal Lee kih...@apache.org
Authored: Mon Sep 15 16:27:22 2014 -0500
Committer: Kihwal Lee kih...@apache.org
Committed: Mon Sep 15 16:27:22 2014 -0500

--
 .../main/java/org/apache/hadoop/ha/HAAdmin.java |  6 --
 hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt |  3 +++
 .../hdfs/tools/TestDFSHAAdminMiniCluster.java   | 20 
 3 files changed, 7 insertions(+), 22 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/2f847b33/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/HAAdmin.java
--
diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/HAAdmin.java
 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/HAAdmin.java
index dfa03e8..bd6366c 100644
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/HAAdmin.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/HAAdmin.java
@@ -143,8 +143,10 @@ public abstract class HAAdmin extends Configured 
implements Tool {
 }
 /*  returns true if other target node is active or some exception occurred 
 and forceActive was not set  */
-if(isOtherTargetNodeActive(argv[0], cmd.hasOption(FORCEACTIVE))) {
-  return -1;
+if(!cmd.hasOption(FORCEACTIVE)) {
+  if(isOtherTargetNodeActive(argv[0], cmd.hasOption(FORCEACTIVE))) {
+return -1;
+  }
 }
 HAServiceTarget target = resolveTarget(argv[0]);
 if (!checkManualStateManagementOK(target)) {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2f847b33/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
--
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt 
b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index 209c7c1..f596265 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -458,6 +458,9 @@ Release 2.6.0 - UNRELEASED
 HDFS-7061. Add test to verify encryption zone creation after NameNode
 restart without saving namespace. (Stephen Chu via wang)
 
+HDFS-7059. HAadmin transtionToActive with forceActive option can show
+confusing message.
+
   OPTIMIZATIONS
 
 HDFS-6690. Deduplicate xattr names in memory. (wang)

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2f847b33/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSHAAdminMiniCluster.java
--
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSHAAdminMiniCluster.java
 
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSHAAdminMiniCluster.java
index 288bcd0..ee1c184 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSHAAdminMiniCluster.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSHAAdminMiniCluster.java
@@ -232,26 +232,6 @@ public class TestDFSHAAdminMiniCluster {
 assertFalse(Both namenodes cannot be active, nn1.isActiveState() 
  nn2.isActiveState());

-/*  This test case doesn't allow nn2 to transition to Active even with
-forceActive switch since nn1 is already active  */
-if(nn1.getState() != null  !nn1.getState().
-equals(HAServiceState.STANDBY.name()) ) {
-  cluster.transitionToStandby(0);
-}
-if(nn2.getState() != null  !nn2.getState().
-equals(HAServiceState.STANDBY.name()) ) {
-  cluster.transitionToStandby(1);
-}
-//Making sure both the namenode are in standby state
-assertTrue(nn1.isStandbyState());
-assertTrue(nn2.isStandbyState());
-
-runTool(-transitionToActive, nn1);
-runTool(-transitionToActive, nn2,--forceactive);
-
-assertFalse(Both namenodes cannot be active even though with forceActive,
-nn1.isActiveState()  nn2.isActiveState());
-
 /*  In this test case, we have deliberately shut down nn1 and this will
 cause HAAAdmin#isOtherTargetNodeActive to throw an Exception 
 and transitionToActive for nn2 with  forceActive switch will succeed 



git commit: HDFS-7059. HAadmin transtionToActive with forceActive option can show confusing message. Contributed by Rushabh Shah.

2014-09-15 Thread kihwal
Repository: hadoop
Updated Branches:
  refs/heads/trunk 0c8aec43f - 2f847b335


HDFS-7059. HAadmin transtionToActive with forceActive option can show
confusing message. Contributed by Rushabh Shah.


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

Branch: refs/heads/trunk
Commit: 2f847b3357448184aaec935052f34d116ad3a42c
Parents: 0c8aec4
Author: Kihwal Lee kih...@apache.org
Authored: Mon Sep 15 16:27:22 2014 -0500
Committer: Kihwal Lee kih...@apache.org
Committed: Mon Sep 15 16:27:22 2014 -0500

--
 .../main/java/org/apache/hadoop/ha/HAAdmin.java |  6 --
 hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt |  3 +++
 .../hdfs/tools/TestDFSHAAdminMiniCluster.java   | 20 
 3 files changed, 7 insertions(+), 22 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/2f847b33/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/HAAdmin.java
--
diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/HAAdmin.java
 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/HAAdmin.java
index dfa03e8..bd6366c 100644
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/HAAdmin.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/HAAdmin.java
@@ -143,8 +143,10 @@ public abstract class HAAdmin extends Configured 
implements Tool {
 }
 /*  returns true if other target node is active or some exception occurred 
 and forceActive was not set  */
-if(isOtherTargetNodeActive(argv[0], cmd.hasOption(FORCEACTIVE))) {
-  return -1;
+if(!cmd.hasOption(FORCEACTIVE)) {
+  if(isOtherTargetNodeActive(argv[0], cmd.hasOption(FORCEACTIVE))) {
+return -1;
+  }
 }
 HAServiceTarget target = resolveTarget(argv[0]);
 if (!checkManualStateManagementOK(target)) {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2f847b33/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
--
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt 
b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index 209c7c1..f596265 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -458,6 +458,9 @@ Release 2.6.0 - UNRELEASED
 HDFS-7061. Add test to verify encryption zone creation after NameNode
 restart without saving namespace. (Stephen Chu via wang)
 
+HDFS-7059. HAadmin transtionToActive with forceActive option can show
+confusing message.
+
   OPTIMIZATIONS
 
 HDFS-6690. Deduplicate xattr names in memory. (wang)

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2f847b33/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSHAAdminMiniCluster.java
--
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSHAAdminMiniCluster.java
 
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSHAAdminMiniCluster.java
index 288bcd0..ee1c184 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSHAAdminMiniCluster.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSHAAdminMiniCluster.java
@@ -232,26 +232,6 @@ public class TestDFSHAAdminMiniCluster {
 assertFalse(Both namenodes cannot be active, nn1.isActiveState() 
  nn2.isActiveState());

-/*  This test case doesn't allow nn2 to transition to Active even with
-forceActive switch since nn1 is already active  */
-if(nn1.getState() != null  !nn1.getState().
-equals(HAServiceState.STANDBY.name()) ) {
-  cluster.transitionToStandby(0);
-}
-if(nn2.getState() != null  !nn2.getState().
-equals(HAServiceState.STANDBY.name()) ) {
-  cluster.transitionToStandby(1);
-}
-//Making sure both the namenode are in standby state
-assertTrue(nn1.isStandbyState());
-assertTrue(nn2.isStandbyState());
-
-runTool(-transitionToActive, nn1);
-runTool(-transitionToActive, nn2,--forceactive);
-
-assertFalse(Both namenodes cannot be active even though with forceActive,
-nn1.isActiveState()  nn2.isActiveState());
-
 /*  In this test case, we have deliberately shut down nn1 and this will
 cause HAAAdmin#isOtherTargetNodeActive to throw an Exception 
 and transitionToActive for nn2 with  forceActive switch will succeed 



git commit: HDFS-7059. HAadmin transtionToActive with forceActive option can show confusing message. Contributed by Rushabh Shah. (cherry picked from commit 2f847b3357448184aaec935052f34d116ad3a42c)

2014-09-15 Thread kihwal
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 1c3f83783 - e6e31fbbb


HDFS-7059. HAadmin transtionToActive with forceActive option can show
confusing message. Contributed by Rushabh Shah.
(cherry picked from commit 2f847b3357448184aaec935052f34d116ad3a42c)


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

Branch: refs/heads/branch-2
Commit: e6e31fbbba1f06c2e7caf0b0d1abbe1a20acaf91
Parents: 1c3f837
Author: Kihwal Lee kih...@apache.org
Authored: Mon Sep 15 16:30:22 2014 -0500
Committer: Kihwal Lee kih...@apache.org
Committed: Mon Sep 15 16:30:22 2014 -0500

--
 .../main/java/org/apache/hadoop/ha/HAAdmin.java |  6 --
 hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt |  3 +++
 .../hdfs/tools/TestDFSHAAdminMiniCluster.java   | 20 
 3 files changed, 7 insertions(+), 22 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/e6e31fbb/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/HAAdmin.java
--
diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/HAAdmin.java
 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/HAAdmin.java
index dfa03e8..bd6366c 100644
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/HAAdmin.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/HAAdmin.java
@@ -143,8 +143,10 @@ public abstract class HAAdmin extends Configured 
implements Tool {
 }
 /*  returns true if other target node is active or some exception occurred 
 and forceActive was not set  */
-if(isOtherTargetNodeActive(argv[0], cmd.hasOption(FORCEACTIVE))) {
-  return -1;
+if(!cmd.hasOption(FORCEACTIVE)) {
+  if(isOtherTargetNodeActive(argv[0], cmd.hasOption(FORCEACTIVE))) {
+return -1;
+  }
 }
 HAServiceTarget target = resolveTarget(argv[0]);
 if (!checkManualStateManagementOK(target)) {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/e6e31fbb/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
--
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt 
b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index 9afe524..080f3b1 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -200,6 +200,9 @@ Release 2.6.0 - UNRELEASED
 HDFS-7061. Add test to verify encryption zone creation after NameNode
 restart without saving namespace. (Stephen Chu via wang)
 
+HDFS-7059. HAadmin transtionToActive with forceActive option can show
+confusing message.
+
   OPTIMIZATIONS
 
 HDFS-6690. Deduplicate xattr names in memory. (wang)

http://git-wip-us.apache.org/repos/asf/hadoop/blob/e6e31fbb/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSHAAdminMiniCluster.java
--
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSHAAdminMiniCluster.java
 
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSHAAdminMiniCluster.java
index 288bcd0..ee1c184 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSHAAdminMiniCluster.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSHAAdminMiniCluster.java
@@ -232,26 +232,6 @@ public class TestDFSHAAdminMiniCluster {
 assertFalse(Both namenodes cannot be active, nn1.isActiveState() 
  nn2.isActiveState());

-/*  This test case doesn't allow nn2 to transition to Active even with
-forceActive switch since nn1 is already active  */
-if(nn1.getState() != null  !nn1.getState().
-equals(HAServiceState.STANDBY.name()) ) {
-  cluster.transitionToStandby(0);
-}
-if(nn2.getState() != null  !nn2.getState().
-equals(HAServiceState.STANDBY.name()) ) {
-  cluster.transitionToStandby(1);
-}
-//Making sure both the namenode are in standby state
-assertTrue(nn1.isStandbyState());
-assertTrue(nn2.isStandbyState());
-
-runTool(-transitionToActive, nn1);
-runTool(-transitionToActive, nn2,--forceactive);
-
-assertFalse(Both namenodes cannot be active even though with forceActive,
-nn1.isActiveState()  nn2.isActiveState());
-
 /*  In this test case, we have deliberately shut down nn1 and this will
 cause HAAAdmin#isOtherTargetNodeActive to throw an Exception 
 and 

[08/10] git commit: HDFS-7059. HAadmin transtionToActive with forceActive option can show confusing message. Contributed by Rushabh Shah.

2014-09-15 Thread arp
HDFS-7059. HAadmin transtionToActive with forceActive option can show
confusing message. Contributed by Rushabh Shah.


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

Branch: refs/heads/HDFS-6581
Commit: 2f847b3357448184aaec935052f34d116ad3a42c
Parents: 0c8aec4
Author: Kihwal Lee kih...@apache.org
Authored: Mon Sep 15 16:27:22 2014 -0500
Committer: Kihwal Lee kih...@apache.org
Committed: Mon Sep 15 16:27:22 2014 -0500

--
 .../main/java/org/apache/hadoop/ha/HAAdmin.java |  6 --
 hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt |  3 +++
 .../hdfs/tools/TestDFSHAAdminMiniCluster.java   | 20 
 3 files changed, 7 insertions(+), 22 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/2f847b33/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/HAAdmin.java
--
diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/HAAdmin.java
 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/HAAdmin.java
index dfa03e8..bd6366c 100644
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/HAAdmin.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/HAAdmin.java
@@ -143,8 +143,10 @@ public abstract class HAAdmin extends Configured 
implements Tool {
 }
 /*  returns true if other target node is active or some exception occurred 
 and forceActive was not set  */
-if(isOtherTargetNodeActive(argv[0], cmd.hasOption(FORCEACTIVE))) {
-  return -1;
+if(!cmd.hasOption(FORCEACTIVE)) {
+  if(isOtherTargetNodeActive(argv[0], cmd.hasOption(FORCEACTIVE))) {
+return -1;
+  }
 }
 HAServiceTarget target = resolveTarget(argv[0]);
 if (!checkManualStateManagementOK(target)) {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2f847b33/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
--
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt 
b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index 209c7c1..f596265 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -458,6 +458,9 @@ Release 2.6.0 - UNRELEASED
 HDFS-7061. Add test to verify encryption zone creation after NameNode
 restart without saving namespace. (Stephen Chu via wang)
 
+HDFS-7059. HAadmin transtionToActive with forceActive option can show
+confusing message.
+
   OPTIMIZATIONS
 
 HDFS-6690. Deduplicate xattr names in memory. (wang)

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2f847b33/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSHAAdminMiniCluster.java
--
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSHAAdminMiniCluster.java
 
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSHAAdminMiniCluster.java
index 288bcd0..ee1c184 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSHAAdminMiniCluster.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSHAAdminMiniCluster.java
@@ -232,26 +232,6 @@ public class TestDFSHAAdminMiniCluster {
 assertFalse(Both namenodes cannot be active, nn1.isActiveState() 
  nn2.isActiveState());

-/*  This test case doesn't allow nn2 to transition to Active even with
-forceActive switch since nn1 is already active  */
-if(nn1.getState() != null  !nn1.getState().
-equals(HAServiceState.STANDBY.name()) ) {
-  cluster.transitionToStandby(0);
-}
-if(nn2.getState() != null  !nn2.getState().
-equals(HAServiceState.STANDBY.name()) ) {
-  cluster.transitionToStandby(1);
-}
-//Making sure both the namenode are in standby state
-assertTrue(nn1.isStandbyState());
-assertTrue(nn2.isStandbyState());
-
-runTool(-transitionToActive, nn1);
-runTool(-transitionToActive, nn2,--forceactive);
-
-assertFalse(Both namenodes cannot be active even though with forceActive,
-nn1.isActiveState()  nn2.isActiveState());
-
 /*  In this test case, we have deliberately shut down nn1 and this will
 cause HAAAdmin#isOtherTargetNodeActive to throw an Exception 
 and transitionToActive for nn2 with  forceActive switch will succeed