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 aa...@apache.org on 2020/12/04 01:43:18 UTC

[hadoop] branch branch-3.2.2 updated: MAPREDUCE-7284. TestCombineFileInputFormat#testMissingBlocks fails (#2136)

This is an automated email from the ASF dual-hosted git repository.

aajisaka pushed a commit to branch branch-3.2.2
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/branch-3.2.2 by this push:
     new 6cda891  MAPREDUCE-7284. TestCombineFileInputFormat#testMissingBlocks fails (#2136)
6cda891 is described below

commit 6cda89110d371e51a5b57f57db365ef71d19d6ab
Author: Akira Ajisaka <aa...@apache.org>
AuthorDate: Wed Jul 15 13:46:20 2020 +0900

    MAPREDUCE-7284. TestCombineFileInputFormat#testMissingBlocks fails (#2136)
    
    (cherry picked from commit 3e7b65c3e5920ed78bd87b68de1075003d86e7a0)
---
 .../lib/input/TestCombineFileInputFormat.java      | 26 ++++++----------------
 1 file changed, 7 insertions(+), 19 deletions(-)

diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/lib/input/TestCombineFileInputFormat.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/lib/input/TestCombineFileInputFormat.java
index cc97a14d..b1eb97b 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/lib/input/TestCombineFileInputFormat.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/lib/input/TestCombineFileInputFormat.java
@@ -1625,22 +1625,15 @@ public class TestCombineFileInputFormat {
    */
   @Test
   public void testMissingBlocks() throws Exception {
-    String namenode = null;
-    MiniDFSCluster dfs = null;
-    FileSystem fileSys = null;
-    String testName = "testMissingBlocks";
-    try {
-      Configuration conf = new Configuration();
-      conf.set("fs.hdfs.impl", MissingBlockFileSystem.class.getName());
-      conf.setBoolean("dfs.replication.considerLoad", false);
-      dfs = new MiniDFSCluster.Builder(conf).racks(rack1).hosts(hosts1)
-          .build();
+    final Configuration conf = new Configuration();
+    conf.set("fs.hdfs.impl", MissingBlockFileSystem.class.getName());
+    conf.setBoolean("dfs.replication.considerLoad", false);
+    try (MiniDFSCluster dfs = new MiniDFSCluster.Builder(conf)
+        .racks(rack1).hosts(hosts1).build()) {
       dfs.waitActive();
 
-      namenode = (dfs.getFileSystem()).getUri().getHost() + ":" +
-                 (dfs.getFileSystem()).getUri().getPort();
-
-      fileSys = dfs.getFileSystem();
+      final FileSystem fileSys =
+          MissingBlockFileSystem.newInstance(dfs.getURI(), conf);
       if (!fileSys.mkdirs(inDir)) {
         throw new IOException("Mkdirs failed to create " + inDir.toString());
       }
@@ -1672,11 +1665,6 @@ public class TestCombineFileInputFormat {
       assertEquals(0, fileSplit.getOffset(1));
       assertEquals(BLOCKSIZE, fileSplit.getLength(1));
       assertEquals(hosts1[0], fileSplit.getLocations()[0]);
-
-    } finally {
-      if (dfs != null) {
-        dfs.shutdown();
-      }
     }
   }
   


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org