|
@@ -1141,28 +1141,28 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean,
|
|
|
// If the file is under construction , then it must be in our
|
|
|
// leases. Find the appropriate lease record.
|
|
|
//
|
|
|
- Lease lease = leaseManager.getLease(holder);
|
|
|
- //
|
|
|
- // We found the lease for this file. And surprisingly the original
|
|
|
- // holder is trying to recreate this file. This should never occur.
|
|
|
- //
|
|
|
- if (lease != null) {
|
|
|
+ Lease lease = leaseManager.getLeaseByPath(src);
|
|
|
+ if (lease == null) {
|
|
|
throw new AlreadyBeingCreatedException(
|
|
|
- "failed to create file " + src + " for " + holder +
|
|
|
- " on client " + clientMachine +
|
|
|
- " because current leaseholder is trying to recreate file.");
|
|
|
+ "failed to create file " + src + " for " + holder +
|
|
|
+ " on client " + clientMachine +
|
|
|
+ " because pendingCreates is non-null but no leases found.");
|
|
|
}
|
|
|
//
|
|
|
- // Find the original holder.
|
|
|
+ // We found the lease for this file. And surprisingly the original
|
|
|
+ // holder is trying to recreate this file. This should never occur.
|
|
|
//
|
|
|
- lease = leaseManager.getLease(pendingFile.clientName);
|
|
|
- if (lease == null) {
|
|
|
+ if (lease.getHolder().equals(holder)) {
|
|
|
throw new AlreadyBeingCreatedException(
|
|
|
- "failed to create file " + src + " for " + holder +
|
|
|
- " on client " + clientMachine +
|
|
|
- " because pendingCreates is non-null but no leases found.");
|
|
|
+ "failed to create file " + src + " for " + holder +
|
|
|
+ " on client " + clientMachine +
|
|
|
+ " because current leaseholder is trying to recreate file.");
|
|
|
}
|
|
|
+ assert lease.getHolder().equals(pendingFile.getClientName()) :
|
|
|
+ "Current lease holder " + lease.getHolder() +
|
|
|
+ " does not match file creator " + pendingFile.getClientName();
|
|
|
//
|
|
|
+ // Current lease holder is different from the requester.
|
|
|
// If the original holder has not renewed in the last SOFTLIMIT
|
|
|
// period, then start lease recovery.
|
|
|
//
|