HBASE-10677 boundaries check in hbck throwing IllegalArgumentException(Rajesh)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1574583 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
bc9834426a
commit
1500ae9438
|
@ -531,13 +531,13 @@ public class HBaseFsck extends Configured {
|
||||||
List<HRegionInfo> regions = MetaScanner.listAllRegions(getConf(), false);
|
List<HRegionInfo> regions = MetaScanner.listAllRegions(getConf(), false);
|
||||||
final RegionBoundariesInformation currentRegionBoundariesInformation =
|
final RegionBoundariesInformation currentRegionBoundariesInformation =
|
||||||
new RegionBoundariesInformation();
|
new RegionBoundariesInformation();
|
||||||
|
Path hbaseRoot = FSUtils.getRootDir(getConf());
|
||||||
for (HRegionInfo regionInfo : regions) {
|
for (HRegionInfo regionInfo : regions) {
|
||||||
|
Path tableDir = FSUtils.getTableDir(hbaseRoot, regionInfo.getTable());
|
||||||
currentRegionBoundariesInformation.regionName = regionInfo.getRegionName();
|
currentRegionBoundariesInformation.regionName = regionInfo.getRegionName();
|
||||||
// For each region, get the start and stop key from the META and compare them to the
|
// For each region, get the start and stop key from the META and compare them to the
|
||||||
// same information from the Stores.
|
// same information from the Stores.
|
||||||
Path path = new Path(getConf().get(HConstants.HBASE_DIR) + "/"
|
Path path = new Path(tableDir, regionInfo.getEncodedName());
|
||||||
+ Bytes.toString(regionInfo.getTable().getName()) + "/"
|
|
||||||
+ regionInfo.getEncodedName() + "/");
|
|
||||||
FileSystem fs = path.getFileSystem(getConf());
|
FileSystem fs = path.getFileSystem(getConf());
|
||||||
FileStatus[] files = fs.listStatus(path);
|
FileStatus[] files = fs.listStatus(path);
|
||||||
// For all the column families in this region...
|
// For all the column families in this region...
|
||||||
|
|
|
@ -2249,6 +2249,19 @@ public class TestHBaseFsck {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRegionBoundariesCheck() throws Exception {
|
||||||
|
HBaseFsck hbck = doFsck(conf, false);
|
||||||
|
assertNoErrors(hbck); // no errors
|
||||||
|
try {
|
||||||
|
hbck.checkRegionBoundaries();
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
if (e.getMessage().endsWith("not a valid DFS filename.")) {
|
||||||
|
fail("Table directory path is not valid." + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@org.junit.Rule
|
@org.junit.Rule
|
||||||
public TestName name = new TestName();
|
public TestName name = new TestName();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue