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

This reverts commit 8d82c44102.
This commit is contained in:
prabhujoseph 2019-12-05 12:31:13 +05:30
parent 8d82c44102
commit 304e75a48b

View File

@ -298,24 +298,20 @@ private void endUpload()
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);
if (timeout == 0) { long startTime = System.currentTimeMillis();
LOG.info("Timeout is set to 0. Skipping replication check."); long endTime = startTime;
} else { long currentReplication = 0;
long startTime = System.currentTimeMillis(); while(endTime - startTime < timeout * 1000 &&
long endTime = startTime; currentReplication < acceptableReplication) {
long currentReplication = 0; Thread.sleep(1000);
while(endTime - startTime < timeout * 1000 && endTime = System.currentTimeMillis();
currentReplication < acceptableReplication) { currentReplication = getSmallestReplicatedBlockCount();
Thread.sleep(1000); }
endTime = System.currentTimeMillis(); if (endTime - startTime >= timeout * 1000) {
currentReplication = getSmallestReplicatedBlockCount(); LOG.error(String.format(
} "Timed out after %d seconds while waiting for acceptable" +
if (endTime - startTime >= timeout * 1000) { " replication of %d (current replication is %d)",
LOG.error(String.format( timeout, acceptableReplication, currentReplication));
"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 " +