HBASE-13989 Threshold for combined MemStore and BlockCache percentages is not checked
This commit is contained in:
parent
3eee730284
commit
4f06279caa
|
@ -111,6 +111,7 @@ public class HeapMemoryManager {
|
|||
}
|
||||
|
||||
private boolean doInit(Configuration conf) {
|
||||
boolean tuningEnabled = true;
|
||||
globalMemStorePercent = HeapMemorySizeUtil.getGlobalMemStorePercent(conf, false);
|
||||
blockCachePercent = conf.getFloat(HFILE_BLOCK_CACHE_SIZE_KEY,
|
||||
HConstants.HFILE_BLOCK_CACHE_SIZE_DEFAULT);
|
||||
|
@ -136,7 +137,7 @@ public class HeapMemoryManager {
|
|||
}
|
||||
if (globalMemStorePercent == globalMemStorePercentMinRange
|
||||
&& globalMemStorePercent == globalMemStorePercentMaxRange) {
|
||||
return false;
|
||||
tuningEnabled = false;
|
||||
}
|
||||
// Initialize max and min range for block cache
|
||||
blockCachePercentMinRange = conf.getFloat(BLOCK_CACHE_SIZE_MIN_RANGE_KEY, blockCachePercent);
|
||||
|
@ -155,9 +156,9 @@ public class HeapMemoryManager {
|
|||
blockCachePercentMaxRange = blockCachePercent;
|
||||
conf.setFloat(BLOCK_CACHE_SIZE_MAX_RANGE_KEY, blockCachePercentMaxRange);
|
||||
}
|
||||
if (blockCachePercent == blockCachePercentMinRange
|
||||
if (tuningEnabled && blockCachePercent == blockCachePercentMinRange
|
||||
&& blockCachePercent == blockCachePercentMaxRange) {
|
||||
return false;
|
||||
tuningEnabled = false;
|
||||
}
|
||||
|
||||
int gml = (int) (globalMemStorePercentMaxRange * CONVERT_TO_PERCENTAGE);
|
||||
|
@ -183,7 +184,7 @@ public class HeapMemoryManager {
|
|||
+ globalMemStorePercentMinRange + " and " + BLOCK_CACHE_SIZE_MAX_RANGE_KEY + " is "
|
||||
+ blockCachePercentMaxRange);
|
||||
}
|
||||
return true;
|
||||
return tuningEnabled;
|
||||
}
|
||||
|
||||
public void start(ChoreService service) {
|
||||
|
|
|
@ -58,8 +58,9 @@ public class TestHeapMemoryManager {
|
|||
@Test
|
||||
public void testAutoTunerShouldBeOffWhenMaxMinRangesForMemstoreIsNotGiven() throws Exception {
|
||||
Configuration conf = HBaseConfiguration.create();
|
||||
conf.setFloat(HeapMemorySizeUtil.MEMSTORE_SIZE_KEY, 0.02f);
|
||||
conf.setFloat(HeapMemoryManager.BLOCK_CACHE_SIZE_MAX_RANGE_KEY, 0.75f);
|
||||
conf.setFloat(HeapMemoryManager.BLOCK_CACHE_SIZE_MIN_RANGE_KEY, 0.05f);
|
||||
conf.setFloat(HeapMemoryManager.BLOCK_CACHE_SIZE_MIN_RANGE_KEY, 0.03f);
|
||||
HeapMemoryManager manager = new HeapMemoryManager(new BlockCacheStub(0),
|
||||
new MemstoreFlusherStub(0), new RegionServerStub(conf), new RegionServerAccountingStub());
|
||||
assertFalse(manager.isTunerOn());
|
||||
|
@ -68,8 +69,9 @@ public class TestHeapMemoryManager {
|
|||
@Test
|
||||
public void testAutoTunerShouldBeOffWhenMaxMinRangesForBlockCacheIsNotGiven() throws Exception {
|
||||
Configuration conf = HBaseConfiguration.create();
|
||||
conf.setFloat(HConstants.HFILE_BLOCK_CACHE_SIZE_KEY, 0.02f);
|
||||
conf.setFloat(HeapMemoryManager.MEMSTORE_SIZE_MAX_RANGE_KEY, 0.75f);
|
||||
conf.setFloat(HeapMemoryManager.MEMSTORE_SIZE_MIN_RANGE_KEY, 0.05f);
|
||||
conf.setFloat(HeapMemoryManager.MEMSTORE_SIZE_MIN_RANGE_KEY, 0.03f);
|
||||
HeapMemoryManager manager = new HeapMemoryManager(new BlockCacheStub(0),
|
||||
new MemstoreFlusherStub(0), new RegionServerStub(conf), new RegionServerAccountingStub());
|
||||
assertFalse(manager.isTunerOn());
|
||||
|
|
Loading…
Reference in New Issue