virajjasani commented on a change in pull request #2454:
URL: https://github.com/apache/hbase/pull/2454#discussion_r500199740



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SimpleRegionNormalizer.java
##########
@@ -371,7 +358,11 @@ private boolean skipForMerge(final RegionStates 
regionStates, final RegionInfo r
       final long nextSizeMb = getRegionSizeMB(next);
       // always merge away empty regions when they present themselves.
       if (currentSizeMb == 0 || nextSizeMb == 0 || currentSizeMb + nextSizeMb 
< avgRegionSizeMb) {
-        plans.add(new MergeNormalizationPlan(current, next));
+        final MergeNormalizationPlan plan = new 
MergeNormalizationPlan.Builder()
+          .addTarget(current, currentSizeMb)
+          .addTarget(next, nextSizeMb)

Review comment:
       Sure this is not normalizer's job to validate but by keeping target 
regions as list, we do have a probability of keeping odd no of regions around a 
while just to get them abandoned later by 
`MergeTableRegionsProcedure#checkRegionsToMerge` if we keep it unbounded list. 
Not that `SimpleRegionNormalizer` will add odd no of regions, this is just to 
be treated as a probability.
   
   How about `List<Pair<NormalizerRegionInfo, NormalizerRegionInfo>>` as target 
regions in `MergeNormalizationPlan`? 
   New POJO `NormalizerRegionInfo` can just contain `regionInfo` and 
`regionSize`. 
   
   Or `List<MergeNormalizerRegionInfo>` where `MergeNormalizerRegionInfo` can 
keep `firstRegion` and `secondRegion` just like how it was before but this time 
we can have list of that object.
   
   This way, at least we indicate a clear way for clients to send list of pair 
of regions to merge. Thought?




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


Reply via email to