joshelser commented on a change in pull request #3: Hbase 22567
URL: https://github.com/apache/hbase-operator-tools/pull/3#discussion_r292984224
 
 

 ##########
 File path: hbase-hbck2/src/main/java/org/apache/hbase/HBCK2.java
 ##########
 @@ -164,6 +171,86 @@ int setRegionState(String region, RegionState.State 
newState)
     return EXIT_FAILURE;
   }
 
+  int addMissingRegionsInMeta(String... tableNames) throws  IOException {
+    ExecutorService executorService = Executors.newFixedThreadPool(
+      tableNames.length > Runtime.getRuntime().availableProcessors() ?
+        Runtime.getRuntime().availableProcessors() : tableNames.length);
+    final CountDownLatch countDownLatch = new 
CountDownLatch(tableNames.length);
+    final List<String> encodedRegionNames = new ArrayList<>();
+    String result = "No regions added.";
+    try(final MetaFixer metaFixer = new MetaFixer(this.conf)){
+      //reducing number of retries in case disable fails due to namespace 
table region also missing
+      this.conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 1);
+      try(Connection conn = ConnectionFactory.createConnection(this.conf)) {
+        final Admin admin = conn.getAdmin();
+        for (String table : tableNames) {
+          final TableName tableName = TableName.valueOf(table);
+          if(admin.tableExists(tableName)) {
+            executorService.submit(new Runnable() {
+              @Override public void run() {
+                try {
+                  LOG.debug("running thread for {}", table);
+                  List<Path> missingRegions = 
metaFixer.findMissingRegionsInMETA(table);
 
 Review comment:
   If the configuration is messed up (wrong `hbase.rootdir`, for example), this 
will bubble up to the `printStackTrace` in the catch. The context that we had 
this exception thrown will be lost.
   
   Maybe switch the ExecutorService over to using the methods that return 
Futures to track the completion of all of these tasks? That would also let you 
get right of the CountDownLatch to track completion.

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to