From bea02d229cfdc54a29db3d9689c07fe5b5447e80 Mon Sep 17 00:00:00 2001 From: Brahma Reddy Battula Date: Wed, 7 Jun 2017 16:34:47 +0800 Subject: [PATCH] MAPREDUCE-6676. NNBench should Throw IOException when rename and delete fails. Contributed by Brahma Reddy Battula. --- .../src/test/java/org/apache/hadoop/hdfs/NNBench.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/hdfs/NNBench.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/hdfs/NNBench.java index ee3cc00fd1f..29eac43d66a 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/hdfs/NNBench.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/hdfs/NNBench.java @@ -868,7 +868,10 @@ public class NNBench extends Configured implements Tool { try { // Set up timer for measuring AL startTimeAL = System.currentTimeMillis(); - filesystem.rename(filePath, filePathR); + boolean result = filesystem.rename(filePath, filePathR); + if (!result) { + throw new IOException("rename failed for " + filePath); + } totalTimeAL1 += (System.currentTimeMillis() - startTimeAL); successfulOp = true; @@ -901,7 +904,10 @@ public class NNBench extends Configured implements Tool { try { // Set up timer for measuring AL startTimeAL = System.currentTimeMillis(); - filesystem.delete(filePath, true); + boolean result = filesystem.delete(filePath, true); + if (!result) { + throw new IOException("delete failed for " + filePath); + } totalTimeAL1 += (System.currentTimeMillis() - startTimeAL); successfulOp = true;