hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lin Yiqun (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-10185) TestHFlushInterrupted verifies interrupt state incorrectly
Date Mon, 21 Mar 2016 05:23:25 GMT

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

Lin Yiqun commented on HDFS-10185:
----------------------------------

{quote}
Your new code essentially tests whether Thread.currentThread().interrupt() works or not. Is
this what you want?
{quote}
Yes, my new code is used to check if {{Thread.currentThread().interrupt()}} works. Because
the original code {{assertTrue(Thread.interrupted())}} of checking this is not executed.

{quote}
BTW, is this an attempt to fix HDFS-2043? Shall we duplicate it to HDFS-2043 and submit your
patch there?
{quote}
This issue is not the reason to lead the test failed and the patch is also not a attempt to
fix that. This jira is different with HDFS-2043. Separated of them would be better I think.

> TestHFlushInterrupted verifies interrupt state incorrectly
> ----------------------------------------------------------
>
>                 Key: HDFS-10185
>                 URL: https://issues.apache.org/jira/browse/HDFS-10185
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: test
>            Reporter: Lin Yiqun
>            Assignee: Lin Yiqun
>         Attachments: HDFS-10185.001.patch
>
>
> In unit test {{TestHFlush#testHFlushInterrupted}}, there were some places verifying interrupt
state incorrectly. As follow:
> {code}
>       Thread.currentThread().interrupt();
>       try {
>         stm.hflush();
>         // If we made it past the hflush(), then that means that the ack made it back
>        // from the pipeline before we got to the wait() call. In that case we should
>         // still have interrupted status.
>         assertTrue(Thread.interrupted());
>       } catch (InterruptedIOException ie) {
>         System.out.println("Got expected exception during flush");
>       }
> {code}
> When stm do the {{hflush}} operation, it will throw interrupted exception and the {{assertTrue(Thread.interrupted())}}
will not be execute. And if you put this before the {{hflush}}, this method will clear interrupted
state and the expected exception will not be throw. The similar problem also appears after
in stm.close.
> So we should use a way to get state without clearing interrupted state like {{Thread.currentThread().isInterrupted()}}.



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

Mime
View raw message