HDFS-16180.FsVolumeImpl.nextBlock should consider that the block meta file has been deleted. (#3315)
This commit is contained in:
parent
b6d1971820
commit
9084c728eb
@ -21,6 +21,7 @@
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@ -98,7 +99,8 @@ public boolean accept(File dir, String name) {
|
||||
});
|
||||
|
||||
if (matches == null || matches.length == 0) {
|
||||
throw new IOException("Meta file not found, blockFile=" + blockFile);
|
||||
throw new FileNotFoundException(
|
||||
"Meta file not found, blockFile=" + blockFile);
|
||||
}
|
||||
if (matches.length > 1) {
|
||||
throw new IOException("Found more than one meta files: "
|
||||
|
@ -20,6 +20,7 @@
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
@ -865,7 +866,15 @@ public ExtendedBlock nextBlock() throws IOException {
|
||||
}
|
||||
|
||||
File blkFile = getBlockFile(bpid, block);
|
||||
File metaFile = FsDatasetUtil.findMetaFile(blkFile);
|
||||
File metaFile ;
|
||||
try {
|
||||
metaFile = FsDatasetUtil.findMetaFile(blkFile);
|
||||
} catch (FileNotFoundException e){
|
||||
LOG.warn("nextBlock({}, {}): {}", storageID, bpid,
|
||||
e.getMessage());
|
||||
continue;
|
||||
}
|
||||
|
||||
block.setGenerationStamp(
|
||||
Block.getGenerationStamp(metaFile.getName()));
|
||||
block.setNumBytes(blkFile.length());
|
||||
|
Loading…
Reference in New Issue
Block a user