HADOOP-11685. StorageException complaining " no lease ID" during HBase distributed log splitting. Contributed by Duo Xu.
This commit is contained in:
parent
73822de7c3
commit
1f7ecb0c84
@ -919,6 +919,9 @@ Release 2.8.0 - UNRELEASED
|
|||||||
HADOOP-12520. Use XInclude in hadoop-azure test configuration to isolate
|
HADOOP-12520. Use XInclude in hadoop-azure test configuration to isolate
|
||||||
Azure Storage account keys for service integration tests. (cnauroth)
|
Azure Storage account keys for service integration tests. (cnauroth)
|
||||||
|
|
||||||
|
HADOOP-11685. StorageException complaining " no lease ID" during HBase
|
||||||
|
distributed log splitting (Duo Xu via cnauroth)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
HADOOP-11785. Reduce the number of listStatus operation in distcp
|
HADOOP-11785. Reduce the number of listStatus operation in distcp
|
||||||
|
@ -1503,10 +1503,23 @@ public void storeEmptyFolder(String key, PermissionStatus permissionStatus)
|
|||||||
storePermissionStatus(blob, permissionStatus);
|
storePermissionStatus(blob, permissionStatus);
|
||||||
storeFolderAttribute(blob);
|
storeFolderAttribute(blob);
|
||||||
openOutputStream(blob).close();
|
openOutputStream(blob).close();
|
||||||
} catch (Exception e) {
|
} catch (StorageException e) {
|
||||||
// Caught exception while attempting upload. Re-throw as an Azure
|
// Caught exception while attempting upload. Re-throw as an Azure
|
||||||
// storage exception.
|
// storage exception.
|
||||||
throw new AzureException(e);
|
throw new AzureException(e);
|
||||||
|
} catch (URISyntaxException e) {
|
||||||
|
throw new AzureException(e);
|
||||||
|
} catch (IOException e) {
|
||||||
|
Throwable t = e.getCause();
|
||||||
|
if (t != null && t instanceof StorageException) {
|
||||||
|
StorageException se = (StorageException) t;
|
||||||
|
// If we got this exception, the blob should have already been created
|
||||||
|
if (!se.getErrorCode().equals("LeaseIdMissing")) {
|
||||||
|
throw new AzureException(e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new AzureException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1870,7 +1870,8 @@ private FsPermission applyUMask(final FsPermission permission,
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
* If login fails in getCurrentUser
|
* If login fails in getCurrentUser
|
||||||
*/
|
*/
|
||||||
private PermissionStatus createPermissionStatus(FsPermission permission)
|
@VisibleForTesting
|
||||||
|
PermissionStatus createPermissionStatus(FsPermission permission)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
// Create the permission status for this file based on current user
|
// Create the permission status for this file based on current user
|
||||||
return new PermissionStatus(
|
return new PermissionStatus(
|
||||||
|
@ -21,7 +21,8 @@
|
|||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
import org.apache.hadoop.fs.Path;
|
||||||
|
import org.apache.hadoop.fs.permission.FsPermission;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -104,4 +105,30 @@ public void testIsAtomicRenameKey() {
|
|||||||
assertTrue(store.isAtomicRenameKey(uriPrefix + s));
|
assertTrue(store.isAtomicRenameKey(uriPrefix + s));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests fs.mkdir() function to create a target blob while another thread
|
||||||
|
* is holding the lease on the blob. mkdir should not fail since the blob
|
||||||
|
* already exists.
|
||||||
|
* This is a scenario that would happen in HBase distributed log splitting.
|
||||||
|
* Multiple threads will try to create and update "recovered.edits" folder
|
||||||
|
* under the same path.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testMkdirOnExistingFolderWithLease() throws Exception {
|
||||||
|
SelfRenewingLease lease;
|
||||||
|
final String FILE_KEY = "folderWithLease";
|
||||||
|
// Create the folder
|
||||||
|
fs.mkdirs(new Path(FILE_KEY));
|
||||||
|
NativeAzureFileSystem nfs = (NativeAzureFileSystem) fs;
|
||||||
|
String fullKey = nfs.pathToKey(nfs.makeAbsolute(new Path(FILE_KEY)));
|
||||||
|
AzureNativeFileSystemStore store = nfs.getStore();
|
||||||
|
// Acquire the lease on the folder
|
||||||
|
lease = store.acquireLease(fullKey);
|
||||||
|
assertTrue(lease.getLeaseID() != null);
|
||||||
|
// Try to create the same folder
|
||||||
|
store.storeEmptyFolder(fullKey,
|
||||||
|
nfs.createPermissionStatus(FsPermission.getDirDefault()));
|
||||||
|
lease.free();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user