HBASE-14469 Fix comment, validation and logging in HeapMemorySizeUtil.getGlobalMemStoreLowerMark
This commit is contained in:
parent
8db7a6eb07
commit
dff86542d5
|
@ -90,24 +90,31 @@ public class HeapMemorySizeUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve configured size for global memstore lower water mark as percentage of total heap.
|
* Retrieve configured size for global memstore lower water mark as fraction of global memstore
|
||||||
* @param c
|
* size.
|
||||||
* @param globalMemStorePercent
|
|
||||||
*/
|
*/
|
||||||
public static float getGlobalMemStoreLowerMark(final Configuration c, float globalMemStorePercent) {
|
public static float getGlobalMemStoreLowerMark(final Configuration conf, float globalMemStorePercent) {
|
||||||
String lowMarkPercentStr = c.get(MEMSTORE_SIZE_LOWER_LIMIT_KEY);
|
String lowMarkPercentStr = conf.get(MEMSTORE_SIZE_LOWER_LIMIT_KEY);
|
||||||
if (lowMarkPercentStr != null) {
|
if (lowMarkPercentStr != null) {
|
||||||
return Float.parseFloat(lowMarkPercentStr);
|
float lowMarkPercent = Float.parseFloat(lowMarkPercentStr);
|
||||||
|
if (lowMarkPercent > 1.0f) {
|
||||||
|
LOG.error("Bad configuration value for " + MEMSTORE_SIZE_LOWER_LIMIT_KEY + ": " +
|
||||||
|
lowMarkPercent + ". Using 1.0f instead.");
|
||||||
|
lowMarkPercent = 1.0f;
|
||||||
}
|
}
|
||||||
String lowerWaterMarkOldValStr = c.get(MEMSTORE_SIZE_LOWER_LIMIT_OLD_KEY);
|
return lowMarkPercent;
|
||||||
|
}
|
||||||
|
String lowerWaterMarkOldValStr = conf.get(MEMSTORE_SIZE_LOWER_LIMIT_OLD_KEY);
|
||||||
if (lowerWaterMarkOldValStr != null) {
|
if (lowerWaterMarkOldValStr != null) {
|
||||||
LOG.warn(MEMSTORE_SIZE_LOWER_LIMIT_OLD_KEY + " is deprecated. Instead use "
|
LOG.warn(MEMSTORE_SIZE_LOWER_LIMIT_OLD_KEY + " is deprecated. Instead use "
|
||||||
+ MEMSTORE_SIZE_LOWER_LIMIT_KEY);
|
+ MEMSTORE_SIZE_LOWER_LIMIT_KEY);
|
||||||
float lowerWaterMarkOldVal = Float.parseFloat(lowerWaterMarkOldValStr);
|
float lowerWaterMarkOldVal = Float.parseFloat(lowerWaterMarkOldValStr);
|
||||||
if (lowerWaterMarkOldVal > globalMemStorePercent) {
|
if (lowerWaterMarkOldVal > globalMemStorePercent) {
|
||||||
lowerWaterMarkOldVal = globalMemStorePercent;
|
lowerWaterMarkOldVal = globalMemStorePercent;
|
||||||
LOG.info("Setting globalMemStoreLimitLowMark == globalMemStoreLimit " + "because supplied "
|
LOG.error("Value of " + MEMSTORE_SIZE_LOWER_LIMIT_OLD_KEY + " (" + lowerWaterMarkOldVal
|
||||||
+ MEMSTORE_SIZE_LOWER_LIMIT_OLD_KEY + " was > " + MEMSTORE_SIZE_OLD_KEY);
|
+ ") is greater than global memstore limit (" + globalMemStorePercent + ") set by "
|
||||||
|
+ MEMSTORE_SIZE_KEY + "/" + MEMSTORE_SIZE_OLD_KEY + ". Setting memstore lower limit "
|
||||||
|
+ "to " + globalMemStorePercent);
|
||||||
}
|
}
|
||||||
return lowerWaterMarkOldVal / globalMemStorePercent;
|
return lowerWaterMarkOldVal / globalMemStorePercent;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue