diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 01bb92d521..dcedb9ff53 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -672,6 +672,8 @@ Release 2.8.0 - UNRELEASED HDFS-8640. Make reserved RBW space visible through JMX. (kanaka kumar avvaru via Arpit Agarwal) + HDFS-8665. Fix replication check in DFSTestUtils#waitForReplication. (wang) + OPTIMIZATIONS HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/DFSTestUtil.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/DFSTestUtil.java index 96fb669435..89ee674ff4 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/DFSTestUtil.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/DFSTestUtil.java @@ -535,7 +535,14 @@ public static void waitForReplication(final DistributedFileSystem dfs, public Boolean get() { try { FileStatus stat = dfs.getFileStatus(file); - return replication == stat.getReplication(); + BlockLocation[] locs = dfs.getFileBlockLocations(stat, 0, stat + .getLen()); + for (BlockLocation loc : locs) { + if (replication != loc.getHosts().length) { + return false; + } + } + return true; } catch (IOException e) { LOG.info("getFileStatus on path " + file + " failed!", e); return false;