saintstack commented on a change in pull request #2352:
URL: https://github.com/apache/hbase/pull/2352#discussion_r594777019



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/TableStateManager.java
##########
@@ -318,4 +326,39 @@ protected void deleteZooKeeper(TableName tableName) {
       LOG.warn("Failed deleting table state from zookeeper", e);
     }
   }
+
+  public void asyncLoadTableState() {
+    new Thread(() -> {
+      LOG.info("load table state...");
+      ThreadFactoryBuilder builder = new 
ThreadFactoryBuilder().setDaemon(true).setNameFormat("TableStateFetcher" + 
"-%1$d");
+      ExecutorService
+        executorService = 
Executors.newFixedThreadPool(master.getConfiguration().getInt("hbase.table.state.fetcher.threads",10),
 builder.build());
+
+      try {
+        List<Result> results = 
MetaTableAccessor.fullScan(master.getConnection(), 
ClientMetaTableAccessor.QueryType.TABLE);
+        List<Future<Void>> futures = new ArrayList<>();
+        results.forEach(r -> futures.add(executorService.submit(new 
Callable<Void>() {

Review comment:
       How much of a diff does using the executor make?

##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java
##########
@@ -1556,6 +1556,7 @@ public RegionInfo loadRegionFromMeta(String 
regionEncodedName) throws UnknownReg
   }
 
   private void loadMeta() throws IOException {
+    master.getTableStateManager().asyncLoadTableState();

Review comment:
       The 'next work' will be a new PR or another version of this patch? 
Thanks.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to