|
@@ -191,6 +191,11 @@ public class DirectoryScanner implements Runnable {
|
|
|
|
|
|
private final FsVolumeSpi volume;
|
|
private final FsVolumeSpi volume;
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Get the file's length in async block scan
|
|
|
|
+ */
|
|
|
|
+ private final long blockFileLength;
|
|
|
|
+
|
|
private final static Pattern CONDENSED_PATH_REGEX =
|
|
private final static Pattern CONDENSED_PATH_REGEX =
|
|
Pattern.compile("(?<!^)(\\\\|/){2,}");
|
|
Pattern.compile("(?<!^)(\\\\|/){2,}");
|
|
|
|
|
|
@@ -235,6 +240,7 @@ public class DirectoryScanner implements Runnable {
|
|
getCondensedPath(vol.getBasePath());
|
|
getCondensedPath(vol.getBasePath());
|
|
this.blockSuffix = blockFile == null ? null :
|
|
this.blockSuffix = blockFile == null ? null :
|
|
getSuffix(blockFile, condensedVolPath);
|
|
getSuffix(blockFile, condensedVolPath);
|
|
|
|
+ this.blockFileLength = (blockFile != null) ? blockFile.length() : 0;
|
|
if (metaFile == null) {
|
|
if (metaFile == null) {
|
|
this.metaSuffix = null;
|
|
this.metaSuffix = null;
|
|
} else if (blockFile == null) {
|
|
} else if (blockFile == null) {
|
|
@@ -251,6 +257,10 @@ public class DirectoryScanner implements Runnable {
|
|
new File(volume.getBasePath(), blockSuffix);
|
|
new File(volume.getBasePath(), blockSuffix);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ long getBlockFileLength() {
|
|
|
|
+ return blockFileLength;
|
|
|
|
+ }
|
|
|
|
+
|
|
File getMetaFile() {
|
|
File getMetaFile() {
|
|
if (metaSuffix == null) {
|
|
if (metaSuffix == null) {
|
|
return null;
|
|
return null;
|
|
@@ -458,7 +468,7 @@ public class DirectoryScanner implements Runnable {
|
|
// Block metadata file exits and block file is missing
|
|
// Block metadata file exits and block file is missing
|
|
addDifference(diffRecord, statsRecord, info);
|
|
addDifference(diffRecord, statsRecord, info);
|
|
} else if (info.getGenStamp() != memBlock.getGenerationStamp()
|
|
} 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,
|
|
// Block metadata file is missing or has wrong generation stamp,
|
|
// or block file length is different than expected
|
|
// or block file length is different than expected
|
|
statsRecord.mismatchBlocks++;
|
|
statsRecord.mismatchBlocks++;
|