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

This commit is contained in:
Jim Brennan 2021-01-28 18:17:15 +00:00
parent 6184ab07f6
commit f565476939
1 changed files with 4 additions and 8 deletions

View File

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