Skip to content

Commit aff3d57

Browse files
author
xiezhineng
committed
unify code
1 parent f69a1c8 commit aff3d57

File tree

1 file changed

+5
-6
lines changed
  • hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode

1 file changed

+5
-6
lines changed

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,14 +1948,13 @@ public boolean isInStandbyState() {
19481948
*/
19491949
public BlocksWithLocations getBlocks(DatanodeID datanode, long size, long
19501950
minimumBlockSize, long timeInterval) throws IOException {
1951-
if (isGetBlocksCheckOperationEnabled) {
1952-
checkOperation(OperationCategory.READ);
1953-
}
1951+
OperationCategory checkOp =
1952+
isGetBlocksCheckOperationEnabled ? OperationCategory.READ :
1953+
OperationCategory.UNCHECKED;
1954+
checkOperation(checkOp);
19541955
readLock();
19551956
try {
1956-
if (isGetBlocksCheckOperationEnabled) {
1957-
checkOperation(OperationCategory.READ);
1958-
}
1957+
checkOperation(checkOp);
19591958
return getBlockManager().getBlocksWithLocations(datanode, size,
19601959
minimumBlockSize, timeInterval);
19611960
} finally {

0 commit comments

Comments
 (0)