HBASE-12891 Parallel execution for Hbck checkRegionConsistency

Signed-off-by: Andrew Purtell <apurtell@apache.org>

Conflicts:
	hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
This commit is contained in:
rahulgidwani 2015-02-06 15:14:19 -08:00 committed by Andrew Purtell
parent fc7f53f240
commit b14614c948
1 changed files with 29 additions and 3 deletions

View File

@ -1694,11 +1694,21 @@ public class HBaseFsck extends Configured implements Closeable {
*/
private void checkAndFixConsistency()
throws IOException, KeeperException, InterruptedException {
// Divide the checks in two phases. One for default/primary replicas and another
// for the non-primary ones. Keeps code cleaner this way.
// Divide the checks in two phases. One for default/primary replicas and another
// for the non-primary ones. Keeps code cleaner this way.
List<WorkItemRegionConsistency> workItems =
new ArrayList<WorkItemRegionConsistency>(regionInfoMap.size());
for (java.util.Map.Entry<String, HbckInfo> e: regionInfoMap.entrySet()) {
if (e.getValue().getReplicaId() == HRegionInfo.DEFAULT_REPLICA_ID) {
checkRegionConsistency(e.getKey(), e.getValue());
workItems.add(new WorkItemRegionConsistency(e.getKey(), e.getValue()));
}
}
List<Future<Void>> workFutures = executor.invokeAll(workItems);
for(Future<Void> f: workFutures) {
try {
f.get();
} catch(ExecutionException e1) {
LOG.warn("Could not check region consistency " , e1.getCause());
}
}
boolean prevHdfsCheck = shouldCheckHdfs();
@ -2349,6 +2359,22 @@ public class HBaseFsck extends Configured implements Closeable {
}
};
class WorkItemRegionConsistency implements Callable<Void> {
private final String key;
private final HbckInfo hbi;
WorkItemRegionConsistency(String key, HbckInfo hbi) {
this.key = key;
this.hbi = hbi;
}
@Override
public synchronized Void call() throws Exception {
checkRegionConsistency(key, hbi);
return null;
}
}
/**
* Maintain information about a particular table.