HDFS-8665. Fix replication check in DFSTestUtils#waitForReplication.

This commit is contained in:
Andrew Wang 2015-06-25 17:29:24 -07:00
parent aa5b15b03b
commit ff0e5e572f
2 changed files with 10 additions and 1 deletions

View File

@ -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

View File

@ -535,7 +535,14 @@ public class DFSTestUtil {
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;