HDFS-5341. Reduce fsdataset lock duration during directory scanning. Contributed by Qus-Jiawei.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1535188 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1387fb1394
commit
bf3271bd2b
@ -342,6 +342,9 @@ Release 2.3.0 - UNRELEASED
|
||||
|
||||
HDFS-5239. Allow FSNamesystem lock fairness to be configurable (daryn)
|
||||
|
||||
HDFS-5341. Reduce fsdataset lock duration during directory scanning.
|
||||
(Qus-Jiawei via kihwal)
|
||||
|
||||
BUG FIXES
|
||||
HDFS-5034. Remove debug prints from GetFileLinkInfo (Andrew Wang via Colin
|
||||
Patrick McCabe)
|
||||
|
@ -191,6 +191,11 @@ static class ScanInfo implements Comparable<ScanInfo> {
|
||||
|
||||
private final FsVolumeSpi volume;
|
||||
|
||||
/**
|
||||
* Get the file's length in async block scan
|
||||
*/
|
||||
private final long blockFileLength;
|
||||
|
||||
private final static Pattern CONDENSED_PATH_REGEX =
|
||||
Pattern.compile("(?<!^)(\\\\|/){2,}");
|
||||
|
||||
@ -235,6 +240,7 @@ private static String getSuffix(File f, String prefix) {
|
||||
getCondensedPath(vol.getBasePath());
|
||||
this.blockSuffix = blockFile == null ? null :
|
||||
getSuffix(blockFile, condensedVolPath);
|
||||
this.blockFileLength = (blockFile != null) ? blockFile.length() : 0;
|
||||
if (metaFile == null) {
|
||||
this.metaSuffix = null;
|
||||
} else if (blockFile == null) {
|
||||
@ -251,6 +257,10 @@ File getBlockFile() {
|
||||
new File(volume.getBasePath(), blockSuffix);
|
||||
}
|
||||
|
||||
long getBlockFileLength() {
|
||||
return blockFileLength;
|
||||
}
|
||||
|
||||
File getMetaFile() {
|
||||
if (metaSuffix == null) {
|
||||
return null;
|
||||
@ -458,7 +468,7 @@ void scan() {
|
||||
// Block metadata file exits and block file is missing
|
||||
addDifference(diffRecord, statsRecord, info);
|
||||
} else if (info.getGenStamp() != memBlock.getGenerationStamp()
|
||||
|| info.getBlockFile().length() != memBlock.getNumBytes()) {
|
||||
|| info.getBlockFileLength() != memBlock.getNumBytes()) {
|
||||
// Block metadata file is missing or has wrong generation stamp,
|
||||
// or block file length is different than expected
|
||||
statsRecord.mismatchBlocks++;
|
||||
|
Loading…
Reference in New Issue
Block a user