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:
parent
fc7f53f240
commit
b14614c948
|
@ -1694,11 +1694,21 @@ public class HBaseFsck extends Configured implements Closeable {
|
||||||
*/
|
*/
|
||||||
private void checkAndFixConsistency()
|
private void checkAndFixConsistency()
|
||||||
throws IOException, KeeperException, InterruptedException {
|
throws IOException, KeeperException, InterruptedException {
|
||||||
// Divide the checks in two phases. One for default/primary replicas and another
|
// Divide the checks in two phases. One for default/primary replicas and another
|
||||||
// for the non-primary ones. Keeps code cleaner this way.
|
// 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()) {
|
for (java.util.Map.Entry<String, HbckInfo> e: regionInfoMap.entrySet()) {
|
||||||
if (e.getValue().getReplicaId() == HRegionInfo.DEFAULT_REPLICA_ID) {
|
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();
|
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.
|
* Maintain information about a particular table.
|
||||||
|
|
Loading…
Reference in New Issue