HBASE-11627 guard against divide by zero in RegionSplitter logging.
Adds a test for noop rolling splits that fails prior to the addition of the guard. Signed-off-by: Andrew Purtell <apurtell@apache.org>
This commit is contained in:
parent
9936b86f70
commit
e9fd2d5cae
|
@ -584,8 +584,10 @@ public class RegionSplitter {
|
|||
LOG.debug("TOTAL TIME = "
|
||||
+ org.apache.hadoop.util.StringUtils.formatTime(tDiff));
|
||||
LOG.debug("Splits = " + splitCount);
|
||||
if (0 < splitCount) {
|
||||
LOG.debug("Avg Time / Split = "
|
||||
+ org.apache.hadoop.util.StringUtils.formatTime(tDiff / splitCount));
|
||||
}
|
||||
|
||||
splitOut.close();
|
||||
if (table != null){
|
||||
|
|
|
@ -282,6 +282,13 @@ public class TestRegionSplitter {
|
|||
verifyBounds(expectedBounds, tableName);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void noopRollingSplit() throws Exception {
|
||||
final List<byte[]> expectedBounds = new ArrayList<byte[]>();
|
||||
expectedBounds.add(ArrayUtils.EMPTY_BYTE_ARRAY);
|
||||
rollingSplitAndVerify(TestRegionSplitter.class.getSimpleName(), "UniformSplit", expectedBounds);
|
||||
}
|
||||
|
||||
private void rollingSplitAndVerify(String tableName, String splitClass,
|
||||
List<byte[]> expectedBounds) throws Exception {
|
||||
final Configuration conf = UTIL.getConfiguration();
|
||||
|
|
Loading…
Reference in New Issue