You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2019/07/09 19:26:30 UTC

[GitHub] [hbase-operator-tools] joshelser commented on a change in pull request #3: Hbase 22567

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

 ##########
 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:
   Yup, the use of Futures makes that much cleaner. Will have to dig in about the issues of hbase:namespace being messed up :)

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services