accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject [3/3] accumulo git commit: ACCUMULO-3693 ACCUMULO-3692 merge 1.6 to master
Date Mon, 23 Mar 2015 21:00:13 GMT
ACCUMULO-3693 ACCUMULO-3692 merge 1.6 to master


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/a1439e33
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/a1439e33
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/a1439e33

Branch: refs/heads/master
Commit: a1439e330d27139eb7507631323eabcd9ef3cc1f
Parents: 4ca3143 43e9002
Author: Eric C. Newton <eric.newton@gmail.com>
Authored: Mon Mar 23 16:59:51 2015 -0400
Committer: Eric C. Newton <eric.newton@gmail.com>
Committed: Mon Mar 23 16:59:51 2015 -0400

----------------------------------------------------------------------
 .../accumulo/master/TabletGroupWatcher.java     |  6 ++
 .../server/GarbageCollectionLogger.java         |  2 +-
 .../test/BalanceWithOfflineTableIT.java         | 90 ++++++++++++++++++++
 3 files changed, 97 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/a1439e33/server/master/src/main/java/org/apache/accumulo/master/TabletGroupWatcher.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a1439e33/server/tserver/src/main/java/org/apache/accumulo/server/GarbageCollectionLogger.java
----------------------------------------------------------------------
diff --cc server/tserver/src/main/java/org/apache/accumulo/server/GarbageCollectionLogger.java
index 8f3785e,0000000..389a544
mode 100644,000000..100644
--- a/server/tserver/src/main/java/org/apache/accumulo/server/GarbageCollectionLogger.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/server/GarbageCollectionLogger.java
@@@ -1,116 -1,0 +1,116 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one or more
 + * contributor license agreements.  See the NOTICE file distributed with
 + * this work for additional information regarding copyright ownership.
 + * The ASF licenses this file to You under the Apache License, Version 2.0
 + * (the "License"); you may not use this file except in compliance with
 + * the License.  You may obtain a copy of the License at
 + *
 + *     http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + */
 +package org.apache.accumulo.server;
 +
 +import java.lang.management.GarbageCollectorMXBean;
 +import java.lang.management.ManagementFactory;
 +import java.util.HashMap;
 +import java.util.List;
 +
 +import org.apache.accumulo.core.conf.AccumuloConfiguration;
 +import org.apache.accumulo.core.conf.Property;
 +import org.apache.accumulo.server.util.Halt;
 +import org.slf4j.Logger;
 +import org.slf4j.LoggerFactory;
 +
 +public class GarbageCollectionLogger {
 +  private static final Logger log = LoggerFactory.getLogger(GarbageCollectionLogger.class);
 +
 +  private final HashMap<String,Long> prevGcTime = new HashMap<String,Long>();
 +  private long lastMemorySize = 0;
 +  private long gcTimeIncreasedCount = 0;
 +  private static long lastMemoryCheckTime = 0;
 +
 +  public GarbageCollectionLogger() {}
 +
 +  public synchronized void logGCInfo(AccumuloConfiguration conf) {
 +    final long now = System.currentTimeMillis();
 +
 +    List<GarbageCollectorMXBean> 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) {
 +      final long diff = now - lastMemoryCheckTime;
-       if (diff > keepAliveTimeout) {
++      if (diff > keepAliveTimeout + 1000) {
 +        log.warn(String.format("GC pause checker not called in a timely fashion. Expected
every %.1f seconds but was %.1f seconds since last check",
 +            keepAliveTimeout / 1000., diff / 1000.));
 +      }
 +      lastMemoryCheckTime = now;
 +      return;
 +    }
 +
 +    if (maxIncreaseInCollectionTime > keepAliveTimeout) {
 +      Halt.halt("Garbage collection may be interfering with lock keep-alive.  Halting.",
-1);
 +    }
 +
 +    lastMemorySize = mem;
 +    lastMemoryCheckTime = now;
 +  }
 +
 +}


Mime
View raw message