HDFS-9514. TestDistributedFileSystem.testDFSClientPeerWriteTimeout failing; exception being swallowed. (Wei-Chiu Chuang via Yongjun Zhang)

(cherry picked from commit bf5295b118)
This commit is contained in:
Yongjun Zhang 2015-12-11 19:52:38 -08:00
parent 3fc9593318
commit be167d0154
2 changed files with 20 additions and 10 deletions

View File

@ -879,6 +879,9 @@ Release 2.8.0 - UNRELEASED
HDFS-9519. Some coding improvement in SecondaryNameNode#main.
(Xiao Chen via Yongjun Zhang)
HDFS-9514. TestDistributedFileSystem.testDFSClientPeerWriteTimeout failing;
exception being swallowed. (Wei-Chiu Chuang via Yongjun Zhang)
OPTIMIZATIONS
HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than

View File

@ -1096,10 +1096,14 @@ public class TestDistributedFileSystem {
Assert.fail("read should timeout");
} catch (SocketTimeoutException ste) {
long delta = Time.now() - start;
Assert.assertTrue("read timedout too soon", delta >= timeout*0.9);
Assert.assertTrue("read timedout too late", delta <= timeout*1.1);
} catch (Throwable t) {
Assert.fail("wrong exception:"+t);
if (delta < timeout*0.9) {
throw new IOException("read timedout too soon in " + delta + " ms.",
ste);
}
if (delta > timeout*1.1) {
throw new IOException("read timedout too late in " + delta + " ms.",
ste);
}
}
} finally {
cluster.shutdown();
@ -1143,12 +1147,15 @@ public class TestDistributedFileSystem {
Assert.fail("write finish in " + delta + " ms" + "but should timedout");
} catch (SocketTimeoutException ste) {
long delta = Time.now() - start;
Assert.assertTrue("write timedout too soon in " + delta + " ms",
delta >= timeout * 0.9);
Assert.assertTrue("write timedout too late in " + delta + " ms",
delta <= timeout * 1.2);
} catch (Throwable t) {
Assert.fail("wrong exception:" + t);
if (delta < timeout * 0.9) {
throw new IOException("write timedout too soon in " + delta + " ms.",
ste);
}
if (delta > timeout * 1.2) {
throw new IOException("write timedout too late in " + delta + " ms.",
ste);
}
}
} finally {
cluster.shutdown();