Source:
public boolean normalizeRegions() throws IOException { if (regionNormalizerTracker == null || !regionNormalizerTracker.isNormalizerOn()) { LOG.debug("Region normalization is disabled, don't run region normalizer."); return false; } if (skipRegionManagementAction("region normalizer")) { return false; } if (assignmentManager.hasRegionsInTransition()) { return false; } if (!normalizationInProgressLock.tryLock()) { LOG.info("Normalization already in progress. Skipping request."); return true; } try { final List<TableName> allEnabledTables = new ArrayList<>( tableStateManager.getTablesInStates(TableState.State.ENABLED)); Collections.shuffle(allEnabledTables); try (final Admin admin = asyncClusterConnection.toConnection().getAdmin()) { final List<Future<?>> submittedPlanList = new ArrayList<>(); for (TableName table : allEnabledTables) { if (table.isSystemTable()) { continue; } final TableDescriptor tblDesc = getTableDescriptors().get(table); if (tblDesc != null && !tblDesc.isNormalizationEnabled()) { LOG.debug("Skipping table because normalization is disabled in its" + " table properties.", table); continue; } if (skipRegionManagementAction("region normalizer")) { return false; } final List<NormalizationPlan> plans = normalizer.computePlansForTable(table); if (CollectionUtils.isEmpty(plans)) { LOG.debug("No normalization required for table {}.", table); continue; } for (NormalizationPlan plan : plans) { Future<Void> future = plan.submit(admin); submittedPlanList.add(future); if (plan.getType() == PlanType.SPLIT) { splitPlanCount++; } else if (plan.getType() == PlanType.MERGE) { mergePlanCount++; } } } for (Future<?> submittedPlan : submittedPlanList) { try { submittedPlan.get(); } catch (Exception e) { normalizationPlanFailureCount++; LOG.error("Submitted normalization plan failed with error: ", e); } } } } finally { normalizationInProgressLock.unlock(); } return true; }

Target:
public boolean normalizeRegions() throws IOException { if (regionNormalizerTracker == null || !regionNormalizerTracker.isNormalizerOn()) { LOG.debug("Region normalization is disabled, don't run region normalizer."); return false; } if (skipRegionManagementAction("region normalizer")) { return false; } if (assignmentManager.hasRegionsInTransition()) { return false; } if (!normalizationInProgressLock.tryLock()) { LOG.info("Normalization already in progress. Skipping request."); return true; } try { final List<TableName> allEnabledTables = new ArrayList<>(tableStateManager.getTablesInStates(TableState.State.ENABLED)); Collections.shuffle(allEnabledTables); final List<Long> submittedPlanProcIds = new ArrayList<>(); for (TableName table : allEnabledTables) { if (table.isSystemTable()) { continue; } final TableDescriptor tblDesc = getTableDescriptors().get(table); if (tblDesc != null && !tblDesc.isNormalizationEnabled()) { LOG.debug( "Skipping table because normalization is disabled in its" + " table properties.", table); continue; } if (skipRegionManagementAction("region normalizer")) { return false; } final List<NormalizationPlan> plans = normalizer.computePlansForTable(table); if (CollectionUtils.isEmpty(plans)) { LOG.debug("No normalization required for table {}.", table); continue; } for (NormalizationPlan plan : plans) { long procId = plan.submit(this); submittedPlanProcIds.add(procId); if (plan.getType() == PlanType.SPLIT) { splitPlanCount++; } else if (plan.getType() == PlanType.MERGE) { mergePlanCount++; } } int totalPlansSubmitted = submittedPlanProcIds.size(); if (totalPlansSubmitted > 0 && LOG.isDebugEnabled()) { LOG.debug("Normalizer plans submitted. Total plans count: , procID list: {}", totalPlansSubmitted, submittedPlanProcIds); } } } finally { normalizationInProgressLock.unlock(); } return true; }