HADOOP-12822. Change "Metrics intern cache overflow" log level from WARN to INFO. Contributed by Andras Bokor.

This commit is contained in:
Akira Ajisaka 2016-04-14 10:55:51 +09:00
parent 0d9194df00
commit 27b131e79c

View File

@ -18,15 +18,15 @@
package org.apache.hadoop.metrics2.lib; package org.apache.hadoop.metrics2.lib;
import java.util.Map;
import java.util.LinkedHashMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.metrics2.MetricsInfo; import org.apache.hadoop.metrics2.MetricsInfo;
import org.apache.hadoop.metrics2.MetricsTag; import org.apache.hadoop.metrics2.MetricsTag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.LinkedHashMap;
import java.util.Map;
/** /**
* Helpers to create interned metrics info * Helpers to create interned metrics info
@ -34,7 +34,7 @@
@InterfaceAudience.Public @InterfaceAudience.Public
@InterfaceStability.Evolving @InterfaceStability.Evolving
public class Interns { public class Interns {
private static final Log LOG = LogFactory.getLog(Interns.class); private static final Logger LOG = LoggerFactory.getLogger(Interns.class);
// A simple intern cache with two keys // A simple intern cache with two keys
// (to avoid creating new (combined) key objects for lookup) // (to avoid creating new (combined) key objects for lookup)
@ -47,7 +47,7 @@ private static abstract class CacheWith2Keys<K1, K2, V> {
protected boolean removeEldestEntry(Map.Entry<K1, Map<K2, V>> e) { protected boolean removeEldestEntry(Map.Entry<K1, Map<K2, V>> e) {
boolean overflow = expireKey1At(size()); boolean overflow = expireKey1At(size());
if (overflow && !gotOverflow) { if (overflow && !gotOverflow) {
LOG.warn("Metrics intern cache overflow at "+ size() +" for "+ e); LOG.info("Metrics intern cache overflow at {} for {}", size(), e);
gotOverflow = true; gotOverflow = true;
} }
return overflow; return overflow;
@ -67,7 +67,7 @@ synchronized V add(K1 k1, K2 k2) {
@Override protected boolean removeEldestEntry(Map.Entry<K2, V> e) { @Override protected boolean removeEldestEntry(Map.Entry<K2, V> e) {
boolean overflow = expireKey2At(size()); boolean overflow = expireKey2At(size());
if (overflow && !gotOverflow) { if (overflow && !gotOverflow) {
LOG.warn("Metrics intern cache overflow at "+ size() +" for "+ e); LOG.info("Metrics intern cache overflow at {} for {}", size(), e);
gotOverflow = true; gotOverflow = true;
} }
return overflow; return overflow;