本文整理汇总了Java中org.apache.hadoop.hbase.io.hfile.CorruptHFileException类的典型用法代码示例。如果您正苦于以下问题:Java CorruptHFileException类的具体用法?Java CorruptHFileException怎么用?Java CorruptHFileException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CorruptHFileException类属于org.apache.hadoop.hbase.io.hfile包,在下文中一共展示了CorruptHFileException类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkHFile
import org.apache.hadoop.hbase.io.hfile.CorruptHFileException; //导入依赖的package包/类
/**
* Checks a path to see if it is a valid hfile.
*
* @param p
* full Path to an HFile
* @throws IOException
* This is a connectivity related exception
*/
protected void checkHFile(Path p) throws IOException {
HFile.Reader r = null;
try {
r = HFile.createReader(fs, p, cacheConf, conf);
} catch (CorruptHFileException che) {
LOG.warn("Found corrupt HFile " + p, che);
corrupted.add(p);
if (inQuarantineMode) {
Path dest = createQuarantinePath(p);
LOG.warn("Quarantining corrupt HFile " + p + " into " + dest);
boolean success = fs.mkdirs(dest.getParent());
success = success ? fs.rename(p, dest): false;
if (!success) {
failures.add(p);
} else {
quarantined.add(dest);
}
}
return;
} catch (FileNotFoundException fnfe) {
LOG.warn("HFile " + p + " was missing. Likely removed due to compaction/split?");
missing.add(p);
} finally {
hfilesChecked.addAndGet(1);
if (r != null) {
r.close(true);
}
}
}
示例2: checkHFile
import org.apache.hadoop.hbase.io.hfile.CorruptHFileException; //导入依赖的package包/类
/**
* Checks a path to see if it is a valid hfile.
*
* @param p
* full Path to an HFile
* @throws IOException
* This is a connectivity related exception
*/
protected void checkHFile(Path p) throws IOException {
HFile.Reader r = null;
try {
r = HFile.createReader(fs, p, cacheConf);
} catch (CorruptHFileException che) {
LOG.warn("Found corrupt HFile " + p, che);
corrupted.add(p);
if (inQuarantineMode) {
Path dest = createQuarantinePath(p);
LOG.warn("Quarantining corrupt HFile " + p + " into " + dest);
boolean success = fs.mkdirs(dest.getParent());
success = success ? fs.rename(p, dest): false;
if (!success) {
failures.add(p);
} else {
quarantined.add(dest);
}
}
return;
} catch (FileNotFoundException fnfe) {
LOG.warn("HFile " + p + " was missing. Likely removed due to compaction/split?");
missing.add(p);
} finally {
hfilesChecked.addAndGet(1);
if (r != null) {
r.close(true);
}
}
}
示例3: checkHFile
import org.apache.hadoop.hbase.io.hfile.CorruptHFileException; //导入依赖的package包/类
/**
* Checks a path to see if it is a valid hfile.
*
* @param p
* full Path to an HFile
* @throws IOException
* This is a connectivity related exception
*/
protected void checkHFile(Path p) throws IOException {
HFile.Reader r = null;
try {
r = HFile.createReader(fs, p, cacheConf, true, conf);
} catch (CorruptHFileException che) {
LOG.warn("Found corrupt HFile " + p, che);
corrupted.add(p);
if (inQuarantineMode) {
Path dest = createQuarantinePath(p);
LOG.warn("Quarantining corrupt HFile " + p + " into " + dest);
boolean success = fs.mkdirs(dest.getParent());
success = success ? fs.rename(p, dest): false;
if (!success) {
failures.add(p);
} else {
quarantined.add(dest);
}
}
return;
} catch (FileNotFoundException fnfe) {
LOG.warn("HFile " + p + " was missing. Likely removed due to compaction/split?");
missing.add(p);
} finally {
hfilesChecked.addAndGet(1);
if (r != null) {
r.close(true);
}
}
}
示例4: checkMobFile
import org.apache.hadoop.hbase.io.hfile.CorruptHFileException; //导入依赖的package包/类
/**
* Checks a path to see if it is a valid mob file.
*
* @param p
* full Path to a mob file.
* @throws IOException
* This is a connectivity related exception
*/
protected void checkMobFile(Path p) throws IOException {
HFile.Reader r = null;
try {
r = HFile.createReader(fs, p, cacheConf, true, conf);
} catch (CorruptHFileException che) {
LOG.warn("Found corrupt mob file " + p, che);
corruptedMobFiles.add(p);
if (inQuarantineMode) {
Path dest = createQuarantinePath(p);
LOG.warn("Quarantining corrupt mob file " + p + " into " + dest);
boolean success = fs.mkdirs(dest.getParent());
success = success ? fs.rename(p, dest): false;
if (!success) {
failureMobFiles.add(p);
} else {
quarantinedMobFiles.add(dest);
}
}
return;
} catch (FileNotFoundException fnfe) {
LOG.warn("Mob file " + p + " was missing. Likely removed due to compaction?");
missedMobFiles.add(p);
} finally {
mobFilesChecked.addAndGet(1);
if (r != null) {
r.close(true);
}
}
}
示例5: testReadFromCorruptMobFiles
import org.apache.hadoop.hbase.io.hfile.CorruptHFileException; //导入依赖的package包/类
@Test
public void testReadFromCorruptMobFiles() throws Exception {
final TableName tableName = TableName.valueOf(name.getMethodName());
setUp(0, tableName);
createRecordAndCorruptMobFile(tableName, row1, family, qf1, Bytes.toBytes("value1"));
Get get = new Get(row1);
IOException ioe = null;
try {
table.get(get);
} catch (IOException e) {
ioe = e;
}
Assert.assertNotNull(ioe);
Assert.assertEquals(CorruptHFileException.class.getName(), ioe.getClass().getName());
}
示例6: preScannerNext
import org.apache.hadoop.hbase.io.hfile.CorruptHFileException; //导入依赖的package包/类
@Override
public boolean preScannerNext(ObserverContext<RegionCoprocessorEnvironment> e,
InternalScanner s, List<Result> results, int limit, boolean hasMore) throws IOException {
throw new CorruptHFileException("For test");
}