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

This commit is contained in:
Mingliang Liu 2017-03-30 15:44:06 -07:00
parent b58777a9c9
commit e5f0622a6f

View File

@ -328,9 +328,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));
}
}
}