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:
rajeshbabu 2014-03-05 17:35:30 +00:00
parent bc9834426a
commit 1500ae9438
2 changed files with 16 additions and 3 deletions

View File

@ -531,13 +531,13 @@ public class HBaseFsck extends Configured {
List<HRegionInfo> regions = MetaScanner.listAllRegions(getConf(), false);
final RegionBoundariesInformation currentRegionBoundariesInformation =
new RegionBoundariesInformation();
Path hbaseRoot = FSUtils.getRootDir(getConf());
for (HRegionInfo regionInfo : regions) {
Path tableDir = FSUtils.getTableDir(hbaseRoot, regionInfo.getTable());
currentRegionBoundariesInformation.regionName = regionInfo.getRegionName();
// For each region, get the start and stop key from the META and compare them to the
// same information from the Stores.
Path path = new Path(getConf().get(HConstants.HBASE_DIR) + "/"
+ Bytes.toString(regionInfo.getTable().getName()) + "/"
+ regionInfo.getEncodedName() + "/");
Path path = new Path(tableDir, regionInfo.getEncodedName());
FileSystem fs = path.getFileSystem(getConf());
FileStatus[] files = fs.listStatus(path);
// For all the column families in this region...

View File

@ -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
public TestName name = new TestName();
}