wchevreuil commented on code in PR #8498:
URL: https://github.com/apache/hbase/pull/8498#discussion_r3645599389
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/master/normalizer/TestSimpleRegionNormalizer.java:
##########
@@ -750,4 +750,26 @@ private static Map<byte[], Integer>
createRegionSizesMap(final List<RegionInfo>
}
return ret;
}
+
+ @Test
+ public void itIgnoresSecondaryReplicasForMergeAndSplitPlanning() {
+ conf.setBoolean(SPLIT_ENABLED_KEY, true);
+ conf.setBoolean(MERGE_ENABLED_KEY, true);
+ conf.setInt(MERGE_MIN_REGION_COUNT_KEY, 1);
+ conf.setInt(MERGE_MIN_REGION_SIZE_MB_KEY, 0);
+
+ final List<RegionInfo> primaryRegions = createRegionInfos(tableName, 5);
+ final List<RegionInfo> allRegions = new ArrayList<>(primaryRegions);
+ for (RegionInfo primary : primaryRegions) {
+
allRegions.add(RegionInfoBuilder.newBuilder(tableName).setStartKey(primary.getStartKey())
+
.setEndKey(primary.getEndKey()).setRegionId(primary.getRegionId()).setReplicaId(1).build());
+ }
+
+ final Map<byte[], Integer> regionSizes =
createRegionSizesMap(primaryRegions, 15, 5, 5, 15, 16);
+ setupMocksForNormalizer(regionSizes, allRegions);
+
+ assertThat(normalizer.computePlansForTable(tableDescriptor),
+ contains(new
MergeNormalizationPlan.Builder().addTarget(primaryRegions.get(1), 5)
+ .addTarget(primaryRegions.get(2), 5).build()));
Review Comment:
Shouldn't we also check that normalizer has not created a merge plan for the
replicas?
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/master/normalizer/TestSimpleRegionNormalizer.java:
##########
@@ -750,4 +750,26 @@ private static Map<byte[], Integer>
createRegionSizesMap(final List<RegionInfo>
}
return ret;
}
+
+ @Test
+ public void itIgnoresSecondaryReplicasForMergeAndSplitPlanning() {
Review Comment:
nit: please follow the other tests naming conventions.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]