HBASE-3180: Review periodic master logging, especially ServerManager once a minute
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1029949 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b77e6f4319
commit
1351769c16
|
@ -1088,6 +1088,8 @@ Release 0.21.0 - Unreleased
|
||||||
HBASE-3120 [rest] Content transcoding
|
HBASE-3120 [rest] Content transcoding
|
||||||
HBASE-3181 Review, document, and fix up Regions-in-Transition timeout
|
HBASE-3181 Review, document, and fix up Regions-in-Transition timeout
|
||||||
logic
|
logic
|
||||||
|
HBASE-3180 Review periodic master logging, especially ServerManager once
|
||||||
|
a minute
|
||||||
|
|
||||||
|
|
||||||
NEW FEATURES
|
NEW FEATURES
|
||||||
|
|
|
@ -110,8 +110,13 @@ class CatalogJanitor extends Chore {
|
||||||
for (Map.Entry<HRegionInfo, Result> e : splitParents.entrySet()) {
|
for (Map.Entry<HRegionInfo, Result> e : splitParents.entrySet()) {
|
||||||
if (cleanParent(e.getKey(), e.getValue())) cleaned++;
|
if (cleanParent(e.getKey(), e.getValue())) cleaned++;
|
||||||
}
|
}
|
||||||
|
if (cleaned != 0) {
|
||||||
LOG.info("Scanned " + count.get() + " catalog row(s) and gc'd " + cleaned +
|
LOG.info("Scanned " + count.get() + " catalog row(s) and gc'd " + cleaned +
|
||||||
" unreferenced parent region(s)");
|
" unreferenced parent region(s)");
|
||||||
|
} else if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("Scanned " + count.get() + " catalog row(s) and gc'd " + cleaned +
|
||||||
|
" unreferenced parent region(s)");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -155,12 +155,10 @@ public class LoadBalancer {
|
||||||
if(serversByLoad.lastKey().getLoad().getNumberOfRegions() <= max &&
|
if(serversByLoad.lastKey().getLoad().getNumberOfRegions() <= max &&
|
||||||
serversByLoad.firstKey().getLoad().getNumberOfRegions() >= min) {
|
serversByLoad.firstKey().getLoad().getNumberOfRegions() >= min) {
|
||||||
// Skipped because no server outside (min,max) range
|
// Skipped because no server outside (min,max) range
|
||||||
if(LOG.isDebugEnabled()) {
|
LOG.info("Skipping load balancing. servers=" + numServers + " " +
|
||||||
LOG.debug("Skipping load balancing. servers=" + numServers + " " +
|
|
||||||
"regions=" + numRegions + " average=" + average + " " +
|
"regions=" + numRegions + " average=" + average + " " +
|
||||||
"mostloaded=" + serversByLoad.lastKey().getLoad().getNumberOfRegions() +
|
"mostloaded=" + serversByLoad.lastKey().getLoad().getNumberOfRegions() +
|
||||||
" leastloaded=" + serversByLoad.lastKey().getLoad().getNumberOfRegions());
|
" leastloaded=" + serversByLoad.lastKey().getLoad().getNumberOfRegions());
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,6 +392,7 @@ public class LoadBalancer {
|
||||||
* @return ordered list of hosts holding blocks of the specified region
|
* @return ordered list of hosts holding blocks of the specified region
|
||||||
* @throws IOException if any filesystem errors
|
* @throws IOException if any filesystem errors
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private List<String> getTopBlockLocations(FileSystem fs, HRegionInfo region)
|
private List<String> getTopBlockLocations(FileSystem fs, HRegionInfo region)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
String encodedName = region.getEncodedName();
|
String encodedName = region.getEncodedName();
|
||||||
|
|
|
@ -31,7 +31,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.hbase.Chore;
|
|
||||||
import org.apache.hadoop.hbase.HMsg;
|
import org.apache.hadoop.hbase.HMsg;
|
||||||
import org.apache.hadoop.hbase.HRegionInfo;
|
import org.apache.hadoop.hbase.HRegionInfo;
|
||||||
import org.apache.hadoop.hbase.HServerAddress;
|
import org.apache.hadoop.hbase.HServerAddress;
|
||||||
|
@ -39,7 +38,6 @@ import org.apache.hadoop.hbase.HServerInfo;
|
||||||
import org.apache.hadoop.hbase.HServerLoad;
|
import org.apache.hadoop.hbase.HServerLoad;
|
||||||
import org.apache.hadoop.hbase.PleaseHoldException;
|
import org.apache.hadoop.hbase.PleaseHoldException;
|
||||||
import org.apache.hadoop.hbase.Server;
|
import org.apache.hadoop.hbase.Server;
|
||||||
import org.apache.hadoop.hbase.Stoppable;
|
|
||||||
import org.apache.hadoop.hbase.YouAreDeadException;
|
import org.apache.hadoop.hbase.YouAreDeadException;
|
||||||
import org.apache.hadoop.hbase.catalog.CatalogTracker;
|
import org.apache.hadoop.hbase.catalog.CatalogTracker;
|
||||||
import org.apache.hadoop.hbase.client.HConnection;
|
import org.apache.hadoop.hbase.client.HConnection;
|
||||||
|
@ -50,10 +48,7 @@ import org.apache.hadoop.hbase.master.handler.MetaServerShutdownHandler;
|
||||||
import org.apache.hadoop.hbase.master.handler.ServerShutdownHandler;
|
import org.apache.hadoop.hbase.master.handler.ServerShutdownHandler;
|
||||||
import org.apache.hadoop.hbase.master.metrics.MasterMetrics;
|
import org.apache.hadoop.hbase.master.metrics.MasterMetrics;
|
||||||
import org.apache.hadoop.hbase.regionserver.Leases.LeaseStillHeldException;
|
import org.apache.hadoop.hbase.regionserver.Leases.LeaseStillHeldException;
|
||||||
import org.apache.hadoop.hbase.util.Pair;
|
|
||||||
import org.apache.hadoop.hbase.util.Threads;
|
import org.apache.hadoop.hbase.util.Threads;
|
||||||
import org.apache.hadoop.util.StringUtils;
|
|
||||||
import org.apache.zookeeper.KeeperException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ServerManager class manages info about region servers - HServerInfo,
|
* The ServerManager class manages info about region servers - HServerInfo,
|
||||||
|
@ -89,8 +84,6 @@ public class ServerManager {
|
||||||
private final Server master;
|
private final Server master;
|
||||||
private final MasterServices services;
|
private final MasterServices services;
|
||||||
|
|
||||||
private final ServerMonitor serverMonitorThread;
|
|
||||||
|
|
||||||
private final LogCleaner logCleaner;
|
private final LogCleaner logCleaner;
|
||||||
|
|
||||||
// Reporting to track master metrics.
|
// Reporting to track master metrics.
|
||||||
|
@ -98,27 +91,6 @@ public class ServerManager {
|
||||||
|
|
||||||
final DeadServer deadservers = new DeadServer();
|
final DeadServer deadservers = new DeadServer();
|
||||||
|
|
||||||
/**
|
|
||||||
* Dumps into log current stats on dead servers and number of servers
|
|
||||||
* TODO: Make this a metric; dump metrics into log.
|
|
||||||
*/
|
|
||||||
class ServerMonitor extends Chore {
|
|
||||||
ServerMonitor(final int period, final Stoppable stopper) {
|
|
||||||
super("ServerMonitor", period, stopper);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void chore() {
|
|
||||||
int numServers = countOfRegionServers();
|
|
||||||
int numDeadServers = deadservers.size();
|
|
||||||
double averageLoad = getAverageLoad();
|
|
||||||
String deadServersList = deadservers.toString();
|
|
||||||
LOG.info("regionservers=" + numServers +
|
|
||||||
", averageload=" + StringUtils.limitDecimalTo2(averageLoad) +
|
|
||||||
((numDeadServers > 0)? (", deadservers=" + deadServersList): ""));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
* @param master
|
* @param master
|
||||||
|
@ -133,10 +105,7 @@ public class ServerManager {
|
||||||
this.services = services;
|
this.services = services;
|
||||||
this.metrics = metrics;
|
this.metrics = metrics;
|
||||||
Configuration c = master.getConfiguration();
|
Configuration c = master.getConfiguration();
|
||||||
int monitorInterval = c.getInt("hbase.master.monitor.interval", 60 * 1000);
|
|
||||||
this.serverMonitorThread = new ServerMonitor(monitorInterval, master);
|
|
||||||
String n = Thread.currentThread().getName();
|
String n = Thread.currentThread().getName();
|
||||||
Threads.setDaemonThreadRunning(this.serverMonitorThread, n + ".serverMonitor");
|
|
||||||
this.logCleaner =
|
this.logCleaner =
|
||||||
new LogCleaner(c.getInt("hbase.master.cleaner.interval", 60 * 1000),
|
new LogCleaner(c.getInt("hbase.master.cleaner.interval", 60 * 1000),
|
||||||
master, c, this.services.getMasterFileSystem().getFileSystem(),
|
master, c, this.services.getMasterFileSystem().getFileSystem(),
|
||||||
|
@ -681,7 +650,6 @@ public class ServerManager {
|
||||||
* Currently just interrupts the ServerMonitor and LogCleaner chores.
|
* Currently just interrupts the ServerMonitor and LogCleaner chores.
|
||||||
*/
|
*/
|
||||||
public void stop() {
|
public void stop() {
|
||||||
this.serverMonitorThread.interrupt();
|
|
||||||
this.logCleaner.interrupt();
|
this.logCleaner.interrupt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue