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 um...@apache.org on 2020/06/16 23:55:38 UTC
[hadoop] branch branch-3.3 updated: HDFS-15389. DFSAdmin should
close filesystem and dfsadmin -setBalancerBandwidth should work with
ViewFSOverloadScheme. Contributed by Ayush Saxena
This is an automated email from the ASF dual-hosted git repository.
umamahesh pushed a commit to branch branch-3.3
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/branch-3.3 by this push:
new bee2846 HDFS-15389. DFSAdmin should close filesystem and dfsadmin -setBalancerBandwidth should work with ViewFSOverloadScheme. Contributed by Ayush Saxena
bee2846 is described below
commit bee2846bee4ae676bdc14585f8a3927a9dd7df37
Author: Ayush Saxena <ay...@apache.org>
AuthorDate: Sat Jun 6 10:49:38 2020 +0530
HDFS-15389. DFSAdmin should close filesystem and dfsadmin -setBalancerBandwidth should work with ViewFSOverloadScheme. Contributed by Ayush Saxena
(cherry picked from commit cc671b16f7b0b7c1ed7b41b96171653dc43cf670)
---
.../java/org/apache/hadoop/hdfs/tools/DFSAdmin.java | 13 +++----------
...TestViewFileSystemOverloadSchemeWithDFSAdmin.java | 20 ++++++++++++++++++++
2 files changed, 23 insertions(+), 10 deletions(-)
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 6ab16c3..ec5fa0a 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
@@ -479,9 +479,9 @@ public class DFSAdmin extends FsShell {
public DFSAdmin(Configuration conf) {
super(conf);
}
-
+
protected DistributedFileSystem getDFS() throws IOException {
- return AdminHelper.getDFS(getConf());
+ return AdminHelper.checkAndGetDFS(getFS(), getConf());
}
/**
@@ -1036,14 +1036,7 @@ public class DFSAdmin extends FsShell {
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());
- return exitCode;
- }
-
- DistributedFileSystem dfs = (DistributedFileSystem) fs;
+ DistributedFileSystem dfs = getDFS();
try{
dfs.setBalancerBandwidth(bandwidth);
System.out.println("Balancer bandwidth is set to " + bandwidth);
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestViewFileSystemOverloadSchemeWithDFSAdmin.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestViewFileSystemOverloadSchemeWithDFSAdmin.java
index 1961dc2..a9475dd 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestViewFileSystemOverloadSchemeWithDFSAdmin.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestViewFileSystemOverloadSchemeWithDFSAdmin.java
@@ -263,4 +263,24 @@ public class TestViewFileSystemOverloadSchemeWithDFSAdmin {
assertOutMsg("Disallowing snapshot on / succeeded", 1);
assertEquals(0, ret);
}
+
+ /**
+ * Tests setBalancerBandwidth with ViewFSOverloadScheme.
+ */
+ @Test
+ public void testSetBalancerBandwidth() throws Exception {
+ final Path hdfsTargetPath = new Path(defaultFSURI + HDFS_USER_FOLDER);
+ addMountLinks(defaultFSURI.getAuthority(),
+ new String[] {HDFS_USER_FOLDER, LOCAL_FOLDER },
+ new String[] {hdfsTargetPath.toUri().toString(),
+ localTargetDir.toURI().toString() },
+ conf);
+ final DFSAdmin dfsAdmin = new DFSAdmin(conf);
+ redirectStream();
+ int ret = ToolRunner.run(dfsAdmin,
+ new String[] {"-fs", defaultFSURI.toString(), "-setBalancerBandwidth",
+ "1000"});
+ assertOutMsg("Balancer bandwidth is set to 1000", 0);
+ assertEquals(0, ret);
+ }
}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org