Skip to content

Commit ff0e5e5

Browse files
committed
HDFS-8665. Fix replication check in DFSTestUtils#waitForReplication.
1 parent aa5b15b commit ff0e5e5

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,8 @@ Release 2.8.0 - UNRELEASED
672672
HDFS-8640. Make reserved RBW space visible through JMX. (kanaka kumar
673673
avvaru via Arpit Agarwal)
674674

675+
HDFS-8665. Fix replication check in DFSTestUtils#waitForReplication. (wang)
676+
675677
OPTIMIZATIONS
676678

677679
HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than

hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/DFSTestUtil.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,14 @@ public static void waitForReplication(final DistributedFileSystem dfs,
535535
public Boolean get() {
536536
try {
537537
FileStatus stat = dfs.getFileStatus(file);
538-
return replication == stat.getReplication();
538+
BlockLocation[] locs = dfs.getFileBlockLocations(stat, 0, stat
539+
.getLen());
540+
for (BlockLocation loc : locs) {
541+
if (replication != loc.getHosts().length) {
542+
return false;
543+
}
544+
}
545+
return true;
539546
} catch (IOException e) {
540547
LOG.info("getFileStatus on path " + file + " failed!", e);
541548
return false;

0 commit comments

Comments
 (0)