HBASE-6384 hbck should group together those sidelined regions need to be bulk loaded later

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1361034 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
jxiang 2012-07-13 03:12:27 +00:00
parent 349c82e0a0
commit 6b3f368bd9
1 changed files with 21 additions and 4 deletions

View File

@ -149,6 +149,7 @@ public class HBaseFsck {
private static boolean rsSupportsOffline = true;
private static final int DEFAULT_OVERLAPS_TO_SIDELINE = 2;
private static final int DEFAULT_MAX_MERGE = 5;
private static final String TO_BE_LOADED = "to_be_loaded";
/**********************
* Internal resources
@ -869,8 +870,20 @@ public class HBaseFsck {
/**
* Sideline a region dir (instead of deleting it)
*/
Path sidelineRegionDir(FileSystem fs, HbckInfo hi)
throws IOException {
Path sidelineRegionDir(FileSystem fs, HbckInfo hi) throws IOException {
return sidelineRegionDir(fs, null, hi);
}
/**
* Sideline a region dir (instead of deleting it)
*
* @param parentDir if specified, the region will be sidelined to
* folder like .../parentDir/<table name>/<region name>. The purpose
* is to group together similar regions sidelined, for example, those
* regions should be bulk loaded back later on. If null, it is ignored.
*/
Path sidelineRegionDir(FileSystem fs,
String parentDir, HbckInfo hi) throws IOException {
String tableName = Bytes.toString(hi.getTableName());
Path regionDir = hi.getHdfsRegionDir();
@ -879,7 +892,11 @@ public class HBaseFsck {
return null;
}
Path sidelineTableDir= new Path(getSidelineDir(), tableName);
Path rootDir = getSidelineDir();
if (parentDir != null) {
rootDir = new Path(rootDir, parentDir);
}
Path sidelineTableDir= new Path(rootDir, tableName);
Path sidelineRegionDir = new Path(sidelineTableDir, regionDir.getName());
fs.mkdirs(sidelineRegionDir);
boolean success = false;
@ -1958,7 +1975,7 @@ public class HBaseFsck {
offline(regionToSideline.getRegionName());
LOG.info("Before sideline big overlapped region: " + regionToSideline.toString());
Path sidelineRegionDir = sidelineRegionDir(fs, regionToSideline);
Path sidelineRegionDir = sidelineRegionDir(fs, TO_BE_LOADED, regionToSideline);
if (sidelineRegionDir != null) {
sidelinedRegions.put(sidelineRegionDir, regionToSideline);
LOG.info("After sidelined big overlapped region: "