MAPREDUCE-7250. FrameworkUploader skip replication check if timeout is 0.

Contributed by Peter Bacsko.
This commit is contained in:
prabhujoseph 2019-12-05 12:32:55 +05:30
parent 304e75a48b
commit da9aa9c909
1 changed files with 18 additions and 14 deletions

View File

@ -298,20 +298,24 @@ public class FrameworkUploader implements Runnable {
fileSystem.setReplication(targetPath, finalReplication); fileSystem.setReplication(targetPath, finalReplication);
LOG.info("Set replication to " + LOG.info("Set replication to " +
finalReplication + " for path: " + targetPath); finalReplication + " for path: " + targetPath);
long startTime = System.currentTimeMillis(); if (timeout == 0) {
long endTime = startTime; LOG.info("Timeout is set to 0. Skipping replication check.");
long currentReplication = 0; } else {
while(endTime - startTime < timeout * 1000 && long startTime = System.currentTimeMillis();
currentReplication < acceptableReplication) { long endTime = startTime;
Thread.sleep(1000); long currentReplication = 0;
endTime = System.currentTimeMillis(); while(endTime - startTime < timeout * 1000 &&
currentReplication = getSmallestReplicatedBlockCount(); currentReplication < acceptableReplication) {
} Thread.sleep(1000);
if (endTime - startTime >= timeout * 1000) { endTime = System.currentTimeMillis();
LOG.error(String.format( currentReplication = getSmallestReplicatedBlockCount();
"Timed out after %d seconds while waiting for acceptable" + }
" replication of %d (current replication is %d)", if (endTime - startTime >= timeout * 1000) {
timeout, acceptableReplication, currentReplication)); LOG.error(String.format(
"Timed out after %d seconds while waiting for acceptable" +
" replication of %d (current replication is %d)",
timeout, acceptableReplication, currentReplication));
}
} }
} else { } else {
LOG.info("Cannot set replication to " + LOG.info("Cannot set replication to " +