From e2e29be973633435aea1aef0d8478482ef4a49b9 Mon Sep 17 00:00:00 2001 From: Mehakmeet Singh Date: Thu, 30 Apr 2020 18:11:46 +0530 Subject: [PATCH 1/2] HADOOP-17018. Intermittent failing of ITestAbfsStreamStatistics in ABFS --- .../fs/azurebfs/ITestAbfsStreamStatistics.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAbfsStreamStatistics.java b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAbfsStreamStatistics.java index b749f496bbfb7..359a0ea7c0366 100644 --- a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAbfsStreamStatistics.java +++ b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAbfsStreamStatistics.java @@ -84,12 +84,20 @@ public void testAbfsStreamOps() throws Exception { LOG.info("Result of Read operation : {}", result); /* - Testing if 2 read_ops value is coming after reading full content from a - file (3 if anything to read from Buffer too). - Reason: read() call gives read_ops=1, - reading from AbfsClient(http GET) gives read_ops=2. + * Testing if 2 read_ops value is coming after reading full content + * from a file (3 if anything to read from Buffer too). Reason: read() + * call gives read_ops=1, reading from AbfsClient(http GET) gives + * read_ops=2. + * + * In some cases ABFS-prefetch thread runs in the background which + * returns some bytes from buffer and gives an extra readOp. + * Thus, making readOps values arbitrary and giving intermittent + * failures in some cases. Hence, readOps values of 2 or 3 is seen in + * different setups. + * */ - assertReadWriteOps("read", 2, statistics.getReadOps()); + assertTrue("Mismatch in read operations", + statistics.getReadOps() == 2 || statistics.getReadOps() == 3); } finally { IOUtils.cleanupWithLogger(LOG, inForOneOperation, From 19a314aa9de013f0dacb58741dcd7788edc7e6a6 Mon Sep 17 00:00:00 2001 From: Mehakmeet Singh Date: Thu, 7 May 2020 15:55:51 +0530 Subject: [PATCH 2/2] HADOOP-17018. Actual value in error message --- .../apache/hadoop/fs/azurebfs/ITestAbfsStreamStatistics.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAbfsStreamStatistics.java b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAbfsStreamStatistics.java index 359a0ea7c0366..51531f678f635 100644 --- a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAbfsStreamStatistics.java +++ b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAbfsStreamStatistics.java @@ -96,7 +96,8 @@ public void testAbfsStreamOps() throws Exception { * different setups. * */ - assertTrue("Mismatch in read operations", + assertTrue(String.format("The actual value of %d was not equal to the " + + "expected value of 2 or 3", statistics.getReadOps()), statistics.getReadOps() == 2 || statistics.getReadOps() == 3); } finally {