HBASE-9434 hbck tries to sideline file to root dir
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1520356 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
285e028f37
commit
ab61360461
|
@ -497,6 +497,7 @@ public class HBaseFsck extends Configured implements Tool {
|
||||||
* likely violate table integrity but will be dealt with by merging
|
* likely violate table integrity but will be dealt with by merging
|
||||||
* overlapping regions.
|
* overlapping regions.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
private void adoptHdfsOrphan(HbckInfo hi) throws IOException {
|
private void adoptHdfsOrphan(HbckInfo hi) throws IOException {
|
||||||
Path p = hi.getHdfsRegionDir();
|
Path p = hi.getHdfsRegionDir();
|
||||||
FileSystem fs = p.getFileSystem(getConf());
|
FileSystem fs = p.getFileSystem(getConf());
|
||||||
|
@ -666,18 +667,18 @@ public class HBaseFsck extends Configured implements Tool {
|
||||||
String pathStr = path.toString();
|
String pathStr = path.toString();
|
||||||
|
|
||||||
// A reference file path should be like
|
// A reference file path should be like
|
||||||
// ${hbase.rootdir}/table_name/region_id/family_name/referred_file.region_name
|
// ${hbase.rootdir}/data/namespace/table_name/region_id/family_name/referred_file.region_name
|
||||||
// Up 3 directories to get the table folder.
|
// Up 5 directories to get the root folder.
|
||||||
// So the file will be sidelined to a similar folder structure.
|
// So the file will be sidelined to a similar folder structure.
|
||||||
int index = pathStr.lastIndexOf(Path.SEPARATOR_CHAR);
|
int index = pathStr.lastIndexOf(Path.SEPARATOR_CHAR);
|
||||||
for (int i = 0; index > 0 && i < 3; i++) {
|
for (int i = 0; index > 0 && i < 5; i++) {
|
||||||
index = pathStr.lastIndexOf(Path.SEPARATOR_CHAR, index);
|
index = pathStr.lastIndexOf(Path.SEPARATOR_CHAR, index - 1);
|
||||||
}
|
}
|
||||||
if (index > 0) {
|
if (index > 0) {
|
||||||
Path rootDir = getSidelineDir();
|
Path rootDir = getSidelineDir();
|
||||||
Path dst = new Path(rootDir, pathStr.substring(index));
|
Path dst = new Path(rootDir, pathStr.substring(index + 1));
|
||||||
fs.mkdirs(dst.getParent());
|
fs.mkdirs(dst.getParent());
|
||||||
LOG.info("Trying to sildeline reference file"
|
LOG.info("Trying to sildeline reference file "
|
||||||
+ path + " to " + dst);
|
+ path + " to " + dst);
|
||||||
setShouldRerun();
|
setShouldRerun();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue