wchevreuil commented on a change in pull request #3: Hbase 22567
URL: https://github.com/apache/hbase-operator-tools/pull/3#discussion_r299165421
##########
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);
+ try {
+ admin.disableTable(tableName);
+ } catch (IOException e) {
+ LOG.warn("Failed to disable table {}, "
Review comment:
We try to disable mostly to make sure we will not be dealing with regions
that are transient, say if split/merge is happening while we scan meta.
Assumption here is that if disable fails, the table is already somehow offline.
That would be the case when even namespace table has missing regions, for
example, so we need to proceed with regions re-insertion even if we are not
able to disable table.
----------------------------------------------------------------
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