HDFS-11592. Closing a file has a wasteful preconditions in NameNode. Contributed by Eric Badger

(cherry picked from commit e5f0622a6f40706d360d45200c8f259c79046438)
This commit is contained in:
Mingliang Liu 2017-03-30 15:44:06 -07:00
parent 60e65a3e55
commit 9e7f8cbf9a

View File

@ -216,9 +216,11 @@ private void assertAllBlocksComplete(int numCommittedAllowed,
for (int i = 0; i < blocks.length; i++) {
final String err = checkBlockComplete(blocks, i, numCommittedAllowed,
minReplication);
Preconditions.checkState(err == null,
"Unexpected block state: %s, file=%s (%s), blocks=%s (i=%s)",
err, this, getClass().getSimpleName(), Arrays.asList(blocks), i);
if(err != null) {
throw new IllegalStateException(String.format("Unexpected block state: " +
"%s, file=%s (%s), blocks=%s (i=%s)", err, this,
getClass().getSimpleName(), Arrays.asList(blocks), i));
}
}
}