@Test public void testMovedWALDuringRecovery() throws Exception { // This partial mock will throw LEE for every file simulating // files that were moved FileSystem spiedFs = Mockito.spy(fs); // The "File does not exist" part is very important, // that's how it comes out of HDFS Mockito.doThrow(new LeaseExpiredException("Injected: File does not exist")). when(spiedFs).append(Mockito.<Path>any()); retryOverHdfsProblem(spiedFs); }
throw new LeaseExpiredException("INode is not a regular file: " + leaseExceptionString(src, fileId, holder)); throw new LeaseExpiredException("File is not open for writing: " + leaseExceptionString(src, fileId, holder)); throw new LeaseExpiredException("Client (=" + holder + ") is not the lease owner (=" + owner + ": " + leaseExceptionString(src, fileId, holder));
|| !clientName.equals(file.getFileUnderConstructionFeature() .getClientName())) { throw new LeaseExpiredException("Lease mismatch: " + block + " is accessed by a non lease holder " + clientName);
private INodeFileUnderConstruction checkLease(String src, String holder, INode file) throws IOException { if (file == null || file.isDirectory()) { Lease lease = leaseManager.getLease(holder); throw new LeaseExpiredException("No lease on " + src + " File does not exist. " + (lease != null ? lease.toString() : "Holder " + holder + " does not have any open files.")); } if (!file.isUnderConstruction()) { Lease lease = leaseManager.getLease(holder); throw new LeaseExpiredException("No lease on " + src + " File is not open for writing. " + (lease != null ? lease.toString() : "Holder " + holder + " does not have any open files.")); } INodeFileUnderConstruction pendingFile = (INodeFileUnderConstruction) file; if (holder != null && !pendingFile.getClientName().equals(holder)) { throw new LeaseExpiredException("Lease mismatch on " + src + " owned by " + pendingFile.getClientName() + " but is accessed by " + holder); } return pendingFile; }
@Test public void testMovedWALDuringRecovery() throws Exception { // This partial mock will throw LEE for every file simulating // files that were moved FileSystem spiedFs = Mockito.spy(fs); // The "File does not exist" part is very important, // that's how it comes out of HDFS Mockito.doThrow(new LeaseExpiredException("Injected: File does not exist")). when(spiedFs).append(Mockito.<Path>any()); retryOverHdfsProblem(spiedFs); }
private void checkLease(String src, String holder, INode file) throws IOException { if (file == null || file.isDirectory()) { Lease lease = leaseManager.getLease(new StringBytesWritable(holder)); throw new LeaseExpiredException("No lease on " + src + " File does not exist. " + (lease != null ? lease.toString() : "Holder " + holder + " does not have any open files.")); } if (!file.isUnderConstruction()) { Lease lease = leaseManager.getLease(new StringBytesWritable(holder)); throw new LeaseExpiredException("No lease on " + src + " File is not open for writing. " + (lease != null ? lease.toString() : "Holder " + holder + " does not have any open files.")); } INodeFileUnderConstruction pendingFile = (INodeFileUnderConstruction)file; if (holder != null && !pendingFile.getClientName().equals(holder)) { throw new LeaseExpiredException("Lease mismatch on " + src + " owned by " + pendingFile.getClientName() + " but is accessed by " + holder); } }
if (inode == null) { Lease lease = leaseManager.getLease(holder); throw new LeaseExpiredException( "No lease on " + ident + ": File does not exist. " + (lease != null ? lease.toString() throw new LeaseExpiredException( "No lease on " + ident + ": INode is not a regular file. " + (lease != null ? lease.toString() if (!file.isUnderConstruction()) { Lease lease = leaseManager.getLease(holder); throw new LeaseExpiredException( "No lease on " + ident + ": File is not open for writing. " + (lease != null ? lease.toString() throw new LeaseExpiredException("Lease mismatch on " + ident + " owned by " + clientName + " but is accessed by " + holder);
if (inode == null) { Lease lease = leaseManager.getLease(holder); throw new LeaseExpiredException( "No lease on " + ident + ": File does not exist. " + (lease != null ? lease.toString() throw new LeaseExpiredException( "No lease on " + ident + ": INode is not a regular file. " + (lease != null ? lease.toString() if (!file.isUnderConstruction()) { Lease lease = leaseManager.getLease(holder); throw new LeaseExpiredException( "No lease on " + ident + ": File is not open for writing. " + (lease != null ? lease.toString() throw new LeaseExpiredException("Lease mismatch on " + ident + " owned by " + clientName + " but is accessed by " + holder);
|| !clientName.equals(file.getFileUnderConstructionFeature() .getClientName())) { throw new LeaseExpiredException("Lease mismatch: " + block + " is accessed by a non lease holder " + clientName);
|| !clientName.equals(file.getFileUnderConstructionFeature() .getClientName())) { throw new LeaseExpiredException("Lease mismatch: " + block + " is accessed by a non lease holder " + clientName);