hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject [2/3] hbase git commit: HBASE-12891 Parallel execution for Hbck checkRegionConsistency
Date Fri, 06 Feb 2015 23:14:40 GMT
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


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/b14614c9
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/b14614c9
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/b14614c9

Branch: refs/heads/branch-1
Commit: b14614c948357d2cc3655c71d6904ea5a8c6b921
Parents: fc7f53f
Author: rahulgidwani <rahul.gidwani@flurry.com>
Authored: Fri Feb 6 15:14:19 2015 -0800
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Fri Feb 6 15:14:19 2015 -0800

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/util/HBaseFsck.java | 32 ++++++++++++++++++--
 1 file changed, 29 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/b14614c9/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
index f1f01c8..377439a 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
@@ -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.


Mime
View raw message