HBASE-6686 HFile Quarantine fails with missing dirs in hadoop 2.0

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1378762 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Hsieh 2012-08-29 22:57:10 +00:00
parent 2aae43110f
commit c8f2cbc38d
1 changed files with 24 additions and 4 deletions

View File

@ -152,9 +152,19 @@ public class HFileCorruptionChecker {
* @throws IOException * @throws IOException
*/ */
protected void checkColFamDir(Path cfDir) throws IOException { protected void checkColFamDir(Path cfDir) throws IOException {
FileStatus[] hfs = fs.listStatus(cfDir, new HFileFilter(fs)); // use same filter as scanner. FileStatus[] hfs = null;
try {
hfs = fs.listStatus(cfDir, new HFileFilter(fs)); // use same filter as scanner.
} catch (FileNotFoundException fnfe) {
// Hadoop 0.23+ listStatus semantics throws an exception if the path does not exist.
LOG.warn("Colfam Directory " + cfDir +
" does not exist. Likely due to concurrent split/compaction. Skipping.");
missing.add(cfDir);
return;
}
// Hadoop 1.0 listStatus does not throw an exception if the path does not exist.
if (hfs.length == 0 && !fs.exists(cfDir)) { if (hfs.length == 0 && !fs.exists(cfDir)) {
// interestingly, listStatus does not throw an exception if the path does not exist.
LOG.warn("Colfam Directory " + cfDir + LOG.warn("Colfam Directory " + cfDir +
" does not exist. Likely due to concurrent split/compaction. Skipping."); " does not exist. Likely due to concurrent split/compaction. Skipping.");
missing.add(cfDir); missing.add(cfDir);
@ -174,9 +184,19 @@ public class HFileCorruptionChecker {
* @throws IOException * @throws IOException
*/ */
protected void checkRegionDir(Path regionDir) throws IOException { protected void checkRegionDir(Path regionDir) throws IOException {
FileStatus[] cfs = fs.listStatus(regionDir, new FamilyDirFilter(fs)); FileStatus[] cfs = null;
try {
cfs = fs.listStatus(regionDir, new FamilyDirFilter(fs));
} catch (FileNotFoundException fnfe) {
// Hadoop 0.23+ listStatus semantics throws an exception if the path does not exist.
LOG.warn("Region Directory " + regionDir +
" does not exist. Likely due to concurrent split/compaction. Skipping.");
missing.add(regionDir);
return;
}
// Hadoop 1.0 listStatus does not throw an exception if the path does not exist.
if (cfs.length == 0 && !fs.exists(regionDir)) { if (cfs.length == 0 && !fs.exists(regionDir)) {
// interestingly, listStatus does not throw an exception if the path does not exist.
LOG.warn("Region Directory " + regionDir + LOG.warn("Region Directory " + regionDir +
" does not exist. Likely due to concurrent split/compaction. Skipping."); " does not exist. Likely due to concurrent split/compaction. Skipping.");
missing.add(regionDir); missing.add(regionDir);