hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ha...@apache.org
Subject hadoop git commit: HDFS-2390. dfsadmin -setBalancerBandwidth does not validate -ve value. Contributed by Gautam Gopalakrishnan.
Date Thu, 27 Aug 2015 10:53:34 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 d63122979 -> 574f3a98c


HDFS-2390. dfsadmin -setBalancerBandwidth does not validate -ve value. Contributed by Gautam
Gopalakrishnan.

(cherry picked from commit 0bf285413f8fcaadbb2d5817fe8090f5fb0d37d9)


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

Branch: refs/heads/branch-2
Commit: 574f3a98ce8b8c0a55dfabc668320dc57a26a087
Parents: d631229
Author: Harsh J <harsh@cloudera.com>
Authored: Thu Aug 27 16:22:48 2015 +0530
Committer: Harsh J <harsh@cloudera.com>
Committed: Thu Aug 27 16:23:22 2015 +0530

----------------------------------------------------------------------
 hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt                   | 3 +++
 .../src/main/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java  | 5 +++++
 .../java/org/apache/hadoop/hdfs/tools/TestDFSAdminWithHA.java | 7 +++++++
 3 files changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/574f3a98/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 5283294..5c18e2d 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -14,6 +14,9 @@ Release 2.8.0 - UNRELEASED
 
   IMPROVEMENTS
 
+    HDFS-2390. dfsadmin -setBalancerBandwidth does not validate -ve value
+    (Gautam Gopalakrishnan via harsh)
+
     HDFS-8821. Explain message "Operation category X is not supported
     in state standby" (Gautam Gopalakrishnan via harsh)
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/574f3a98/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java
index 6f7d8bf..ad4af87 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java
@@ -828,6 +828,11 @@ public class DFSAdmin extends FsShell {
       return exitCode;
     }
 
+    if (bandwidth < 0) {
+      System.err.println("Bandwidth should be a non-negative integer");
+      return exitCode;
+    }
+
     FileSystem fs = getFS();
     if (!(fs instanceof DistributedFileSystem)) {
       System.err.println("FileSystem is " + fs.getUri());

http://git-wip-us.apache.org/repos/asf/hadoop/blob/574f3a98/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSAdminWithHA.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSAdminWithHA.java
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSAdminWithHA.java
index 6859e43..a6c0924 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSAdminWithHA.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSAdminWithHA.java
@@ -193,6 +193,13 @@ public class TestDFSAdminWithHA {
   }
 
   @Test (timeout = 30000)
+  public void testSetNegativeBalancerBandwidth() throws Exception {
+    setUpHaCluster(false);
+    int exitCode = admin.run(new String[] {"-setBalancerBandwidth", "-10"});
+    assertEquals("Negative bandwidth value must fail the command", -1, exitCode);
+  }
+
+  @Test (timeout = 30000)
   public void testMetaSave() throws Exception {
     setUpHaCluster(false);
     int exitCode = admin.run(new String[] {"-metasave", "dfs.meta"});


Mime
View raw message