hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Haohui Mai (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-8767) RawLocalFileSystem.listStatus() returns null for UNIX pipefile
Date Wed, 15 Jul 2015 21:18:05 GMT

    [ https://issues.apache.org/jira/browse/HDFS-8767?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14628756#comment-14628756
] 

Haohui Mai commented on HDFS-8767:
----------------------------------

Thanks for the work. The fix looks good.

bq. --The format looks fine in eclipse. Fixing this will reduce the readability

Readability is subjective. It might make more sense to fix it to avoid the checkstyle warnings.

{code}
+  @Test
+  public void testFileStatusPipeFile() throws Exception {
+    Assume.assumeTrue(SystemUtils.IS_OS_UNIX);
+    String path = TEST_ROOT_DIR + "/testfifofile";
+    new File(path).delete();
+    File fifoFile = new File(path);
+    fifoFile.getParentFile().mkdirs();
+    String fullPath = fifoFile.getAbsolutePath();
+    Process process = Runtime.getRuntime().exec("mkfifo " + fullPath);
+    process.waitFor();
+
+    String input = org.apache.commons.io.IOUtils.toString(process
+        .getInputStream());
+    String errors = org.apache.commons.io.IOUtils.toString(process
+        .getErrorStream());
+    assertTrue("Expected empty but got " + input, "".equals(input));
+    assertTrue("Expected empty but got " + errors, "".equals(errors));
+
+    fifoFile = new File(fullPath);
+    assertTrue("FIFO file should present", fifoFile.exists());
+    assertFalse(fifoFile.isFile());
+    assertFalse(fifoFile.isDirectory());
+
+    Path fsPath = new Path(path);
+    FileSystem fs = fileSys.getRawFileSystem();
+    assertTrue(fs.exists(fsPath));
+    assertNotNull(fs.listStatus(fsPath));
+    fifoFile.delete();
+  }
 }
{code}

To me it seems that it makes more sense to test it through mockito instead of creating a real
pipe file. I'll upload a patch later to demonstrate the proposed approach.


> RawLocalFileSystem.listStatus() returns null for UNIX pipefile
> --------------------------------------------------------------
>
>                 Key: HDFS-8767
>                 URL: https://issues.apache.org/jira/browse/HDFS-8767
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: Haohui Mai
>            Assignee: kanaka kumar avvaru
>            Priority: Critical
>         Attachments: HDFS-8767-00.patch, HDFS-8767-01.patch, HDFS-8767-02.patch
>
>
> Calling FileSystem.listStatus() on a UNIX pipe file returns null instead of the file.
The bug breaks Hive when Hive loads data from UNIX pipe file.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message