HBASE-19418 configurable range of delay in PeriodicMemstoreFlusher

Signed-off-by: Andrew Purtell <apurtell@apache.org>
This commit is contained in:
ramie-raufdeen 2018-09-10 18:39:53 -07:00 committed by Andrew Purtell
parent e26a6e0e10
commit e44ed1b1ef
No known key found for this signature in database
GPG Key ID: 8597754DD5365CCD
2 changed files with 8 additions and 2 deletions

View File

@ -1737,11 +1737,16 @@ public class HRegionServer extends HasThread implements
static class PeriodicMemStoreFlusher extends ScheduledChore {
final HRegionServer server;
final static int RANGE_OF_DELAY = 5 * 60 * 1000; // 5 min in milliseconds
final static int RANGE_OF_DELAY = 5 * 60; // 5 min in seconds
final static int MIN_DELAY_TIME = 0; // millisec
final int rangeOfDelay;
public PeriodicMemStoreFlusher(int cacheFlushInterval, final HRegionServer server) {
super("MemstoreFlusherChore", server, cacheFlushInterval);
this.server = server;
this.rangeOfDelay = this.server.conf.getInt("hbase.regionserver.periodicmemstoreflusher.rangeofdelayseconds",
RANGE_OF_DELAY)*1000;
}
@Override
@ -1752,7 +1757,7 @@ public class HRegionServer extends HasThread implements
if (r.shouldFlush(whyFlush)) {
FlushRequester requester = server.getFlushRequester();
if (requester != null) {
long randomDelay = (long) RandomUtils.nextInt(0, RANGE_OF_DELAY) + MIN_DELAY_TIME;
long randomDelay = (long) RandomUtils.nextInt(0, rangeOfDelay) + MIN_DELAY_TIME;
//Throttle the flushes by putting a delay. If we don't throttle, and there
//is a balanced write-load on the regions in a table, we might end up
//overwhelming the filesystem with too many flushes at once.

View File

@ -112,6 +112,7 @@ public class TestRegionServerMetrics {
// testMobMetrics creates few hfiles and manages compaction manually.
conf.setInt("hbase.hstore.compactionThreshold", 100);
conf.setInt("hbase.hstore.compaction.max", 100);
conf.setInt("hbase.regionserver.periodicmemstoreflusher.rangeofdelayseconds", 4*60);
conf.setInt(HConstants.REGIONSERVER_INFO_PORT, -1);
TEST_UTIL.startMiniCluster(1, 1);