// Remove the RAID prefix to get the source dir.
srcDirsToWatchOutFor.add(
parentUriPath.substring(parentUriPath.indexOf(Path.SEPARATOR, 1)));
int numCorrupt = corruptFiles.get(p);
Priority priority = (numCorrupt > 1) ? Priority.HIGH : Priority.LOW;
LostFileInfo fileInfo = fileIndex.get(p);
if (fileInfo == null || priority.higherThan(fileInfo.getHighestPriority())) {
fileToPriority.put(p, priority);
}
}
// Loop over src files now.
for (Iterator<String> it = corruptFiles.keySet().iterator(); it.hasNext(); ) {
String p = it.next();
if (BlockIntegrityMonitor.isSourceFile(p)) {
FileStatus stat = fs.getFileStatus(new Path(p));
if (stat.getReplication() >= notRaidedReplication) {
continue;
}
if (BlockIntegrityMonitor.doesParityDirExist(fs, p)) {
int numCorrupt = corruptFiles.get(p);
Priority priority = Priority.LOW;
if (stat.getReplication() > 1) {
// If we have a missing block when replication > 1, it is high pri.
priority = Priority.HIGH;
} else {
// Replication == 1. Assume Reed Solomon parity exists.
// If we have more than one missing block when replication == 1, then
// high pri.
priority = (numCorrupt > 1) ? Priority.HIGH : Priority.LOW;
}
// If priority is low, check if the scan of corrupt parity files found
// the src dir to be risky.
if (priority == Priority.LOW) {
Path parent = new Path(p).getParent();
String parentUriPath = parent.toUri().getPath();
if (srcDirsToWatchOutFor.contains(parentUriPath)) {
priority = Priority.HIGH;
}
}
LostFileInfo fileInfo = fileIndex.get(p);
if (fileInfo == null || priority.higherThan(fileInfo.getHighestPriority())) {
fileToPriority.put(p, priority);
}
}
}
}