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++) { for (int i = 0; i < blocks.length; i++) {
final String err = checkBlockComplete(blocks, i, numCommittedAllowed, final String err = checkBlockComplete(blocks, i, numCommittedAllowed,
minReplication); minReplication);
Preconditions.checkState(err == null, if(err != null) {
"Unexpected block state: %s, file=%s (%s), blocks=%s (i=%s)", throw new IllegalStateException(String.format("Unexpected block state: " +
err, this, getClass().getSimpleName(), Arrays.asList(blocks), i); "%s, file=%s (%s), blocks=%s (i=%s)", err, this,
getClass().getSimpleName(), Arrays.asList(blocks), i));
}
} }
} }