Skip to content

Commit f565476

Browse files
committed
[HDFS-15789] Lease renewal does not require namesystem lock. Contributed by Daryn Sharp and Jim Brennan.
1 parent 6184ab0 commit f565476

File tree

1 file changed

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

1 file changed

+4
-8
lines changed

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4087,14 +4087,10 @@ void closeFileCommitBlocks(String src, INodeFile pendingFile,
40874087
*/
40884088
void renewLease(String holder) throws IOException {
40894089
checkOperation(OperationCategory.WRITE);
4090-
readLock();
4091-
try {
4092-
checkOperation(OperationCategory.WRITE);
4093-
checkNameNodeSafeMode("Cannot renew lease for " + holder);
4094-
leaseManager.renewLease(holder);
4095-
} finally {
4096-
readUnlock("renewLease");
4097-
}
4090+
checkNameNodeSafeMode("Cannot renew lease for " + holder);
4091+
// fsn is not mutated so lock is not required. the leaseManger is also
4092+
// thread-safe.
4093+
leaseManager.renewLease(holder);
40984094
}
40994095

41004096
/**

0 commit comments

Comments
 (0)