[HDFS-15789] Lease renewal does not require namesystem lock. Contributed by Daryn Sharp and Jim Brennan.

(cherry picked from commit f565476939)
This commit is contained in:
Jim Brennan 2021-01-28 18:17:15 +00:00
parent 2c70705575
commit 37d8ad7ade
1 changed files with 4 additions and 8 deletions

View File

@ -4019,14 +4019,10 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
*/ */
void renewLease(String holder) throws IOException { void renewLease(String holder) throws IOException {
checkOperation(OperationCategory.WRITE); checkOperation(OperationCategory.WRITE);
readLock(); checkNameNodeSafeMode("Cannot renew lease for " + holder);
try { // fsn is not mutated so lock is not required. the leaseManger is also
checkOperation(OperationCategory.WRITE); // thread-safe.
checkNameNodeSafeMode("Cannot renew lease for " + holder); leaseManager.renewLease(holder);
leaseManager.renewLease(holder);
} finally {
readUnlock("renewLease");
}
} }
/** /**