Lin Yiqun created HDFS-10185:
--------------------------------
Summary: 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
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)