long now = System.currentTimeMillis();
private static final long MAX_TIME_TO_WAIT_FOR_SCAN_RESULT_MILLIS = 1000;
private static final long RECENTLY_SPLIT_MILLIES = 60 * 1000;
private static final long TIME_BETWEEN_GC_CHECKS = 5000;
<<<<<<< HEAD
private static final Set EMPTY_COLUMNS = Collections.emptySet();
=======
private TabletServerLogger logger;
protected TabletServerMinCMetrics mincMetrics = new TabletServerMinCMetrics();
private ServerConfiguration serverConfig;
private LogSorter logSorter = null;
public TabletServer(ServerConfiguration conf, VolumeManager fs) {
super();
this.serverConfig = conf;
this.instance = conf.getInstance();
this.fs = fs;
this.logSorter = new LogSorter(instance, fs, getSystemConfiguration());
SimpleTimer.getInstance().schedule(new Runnable() {
@Override
public void run() {
synchronized (onlineTablets) {
long now = System.currentTimeMillis();
for (Tablet tablet : onlineTablets.values())
try {
tablet.updateRates(now);
} catch (Exception ex) {
log.error(ex, ex);
}
}
}
}, TIME_BETWEEN_GC_CHECKS, TIME_BETWEEN_GC_CHECKS);
}
private synchronized static void logGCInfo(AccumuloConfiguration conf) {
List gcmBeans = ManagementFactory.getGarbageCollectorMXBeans();
Runtime rt = Runtime.getRuntime();
StringBuilder sb = new StringBuilder("gc");
boolean sawChange = false;
long maxIncreaseInCollectionTime = 0;
for (GarbageCollectorMXBean gcBean : gcmBeans) {
Long prevTime = prevGcTime.get(gcBean.getName());
long pt = 0;
if (prevTime != null) {
pt = prevTime;
}
long time = gcBean.getCollectionTime();
if (time - pt != 0) {
sawChange = true;
}
long increaseInCollectionTime = time - pt;
sb.append(String.format(" %s=%,.2f(+%,.2f) secs", gcBean.getName(), time / 1000.0, increaseInCollectionTime / 1000.0));
maxIncreaseInCollectionTime = Math.max(increaseInCollectionTime, maxIncreaseInCollectionTime);
prevGcTime.put(gcBean.getName(), time);
}
long mem = rt.freeMemory();
if (maxIncreaseInCollectionTime == 0) {
gcTimeIncreasedCount = 0;
} else {
gcTimeIncreasedCount++;
if (gcTimeIncreasedCount > 3 && mem < rt.maxMemory() * 0.05) {
log.warn("Running low on memory");
gcTimeIncreasedCount = 0;
}
}
if (mem > lastMemorySize) {
sawChange = true;
}
String sign = "+";
if (mem - lastMemorySize <= 0) {
sign = "";
}
sb.append(String.format(" freemem=%,d(%s%,d) totalmem=%,d", mem, sign, (mem - lastMemorySize), rt.totalMemory()));
if (sawChange) {
log.debug(sb.toString());
}
final long keepAliveTimeout = conf.getTimeInMillis(Property.INSTANCE_ZK_TIMEOUT);
if (lastMemoryCheckTime > 0 && lastMemoryCheckTime < now) {
long diff = now - lastMemoryCheckTime;
if (diff > keepAliveTimeout) {
log.warn(String.format("GC pause checker not called in a timely fashion. Expected every %.1f seconds but was %.1f seconds since last check",
TIME_BETWEEN_GC_CHECKS / 1000., diff / 1000.));
}
lastMemoryCheckTime = now;
return;
}
if (maxIncreaseInCollectionTime > keepAliveTimeout) {
Halt.halt("Garbage collection may be interfering with lock keep-alive. Halting.", -1);
}
>>>>>>> d65e0e32de29206b627e578b957ce66c0d644cea
private final GarbageCollectionLogger gcLogger = new GarbageCollectionLogger();
private final TransactionWatcher watcher = new TransactionWatcher(); |