HBASE-993 Turn of logging of every catalog table row entry on every scan

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@713189 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2008-11-11 21:56:55 +00:00
parent 78ce1b10c9
commit 2966b330ae
8 changed files with 35 additions and 34 deletions

View File

@ -111,6 +111,7 @@ Release 0.19.0 - Unreleased
HBASE-983 Declare Perl namespace in Hbase.thrift HBASE-983 Declare Perl namespace in Hbase.thrift
HBASE-987 We need a Hbase Partitioner for TableMapReduceUtil.initTableReduceJob HBASE-987 We need a Hbase Partitioner for TableMapReduceUtil.initTableReduceJob
MR Jobs (Billy Pearson via Stack) MR Jobs (Billy Pearson via Stack)
HBASE-993 Turn of logging of every catalog table row entry on every scan
NEW FEATURES NEW FEATURES
HBASE-875 Use MurmurHash instead of JenkinsHash [in bloomfilters] HBASE-875 Use MurmurHash instead of JenkinsHash [in bloomfilters]

View File

@ -154,11 +154,11 @@ abstract class BaseScanner extends Chore implements HConstants {
Map<HRegionInfo, RowResult> splitParents = Map<HRegionInfo, RowResult> splitParents =
new HashMap<HRegionInfo, RowResult>(); new HashMap<HRegionInfo, RowResult>();
List<byte []> emptyRows = new ArrayList<byte []>(); List<byte []> emptyRows = new ArrayList<byte []>();
int rows = 0;
try { try {
regionServer = master.connection.getHRegionConnection(region.getServer()); regionServer = master.connection.getHRegionConnection(region.getServer());
scannerId = regionServer.openScanner(region.getRegionName(), scannerId = regionServer.openScanner(region.getRegionName(),
COLUMN_FAMILY_ARRAY, EMPTY_START_ROW, HConstants.LATEST_TIMESTAMP, null); COLUMN_FAMILY_ARRAY, EMPTY_START_ROW, HConstants.LATEST_TIMESTAMP, null);
int numberOfRegionsFound = 0;
while (true) { while (true) {
RowResult values = regionServer.next(scannerId); RowResult values = regionServer.next(scannerId);
if (values == null || values.size() == 0) { if (values == null || values.size() == 0) {
@ -171,20 +171,16 @@ abstract class BaseScanner extends Chore implements HConstants {
} }
String serverName = Writables.cellToString(values.get(COL_SERVER)); String serverName = Writables.cellToString(values.get(COL_SERVER));
long startCode = Writables.cellToLong(values.get(COL_STARTCODE)); long startCode = Writables.cellToLong(values.get(COL_STARTCODE));
if (LOG.isDebugEnabled()) {
LOG.debug(Thread.currentThread().getName() + " " + info.toString() +
"}, SERVER => '" + serverName + "', STARTCODE => " + startCode);
}
// Note Region has been assigned. // Note Region has been assigned.
checkAssigned(info, serverName, startCode); checkAssigned(info, serverName, startCode);
if (isSplitParent(info)) { if (isSplitParent(info)) {
splitParents.put(info, values); splitParents.put(info, values);
} }
numberOfRegionsFound += 1; rows += 1;
} }
if (rootRegion) { if (rootRegion) {
regionManager.setNumMetaRegions(numberOfRegionsFound); regionManager.setNumMetaRegions(rows);
} }
} catch (IOException e) { } catch (IOException e) {
if (e instanceof RemoteException) { if (e instanceof RemoteException) {
@ -226,8 +222,8 @@ abstract class BaseScanner extends Chore implements HConstants {
cleanupSplits(region.getRegionName(), regionServer, hri, e.getValue()); cleanupSplits(region.getRegionName(), regionServer, hri, e.getValue());
} }
} }
LOG.info(Thread.currentThread().getName() + " scan of meta region " + LOG.info(Thread.currentThread().getName() + " scan of " + rows +
region.toString() + " complete"); " row(s) of meta region " + region.toString() + " complete");
} }
/* /*

View File

@ -57,15 +57,14 @@ class MetaScanner extends BaseScanner {
// Don't retry if we get an error while scanning. Errors are most often // Don't retry if we get an error while scanning. Errors are most often
// caused by the server going away. Wait until next rescan interval when // caused by the server going away. Wait until next rescan interval when
// things should be back to normal // things should be back to normal.
private boolean scanOneMetaRegion(MetaRegion region) { private boolean scanOneMetaRegion(MetaRegion region) {
boolean scanSuccessful = false;
while (!master.closed.get() && !regionManager.isInitialRootScanComplete() && while (!master.closed.get() && !regionManager.isInitialRootScanComplete() &&
regionManager.getRootRegionLocation() == null) { regionManager.getRootRegionLocation() == null) {
master.sleeper.sleep(); master.sleeper.sleep();
} }
if (master.closed.get()) { if (master.closed.get()) {
return scanSuccessful; return false;
} }
try { try {
@ -74,7 +73,6 @@ class MetaScanner extends BaseScanner {
scanRegion(region); scanRegion(region);
regionManager.putMetaRegionOnline(region); regionManager.putMetaRegionOnline(region);
} }
scanSuccessful = true;
} catch (IOException e) { } catch (IOException e) {
e = RemoteExceptionHandler.checkIOException(e); e = RemoteExceptionHandler.checkIOException(e);
LOG.warn("Scan one META region: " + region.toString(), e); LOG.warn("Scan one META region: " + region.toString(), e);
@ -85,7 +83,7 @@ class MetaScanner extends BaseScanner {
if (!regionManager.isMetaRegionOnline(region.getStartKey())) { if (!regionManager.isMetaRegionOnline(region.getStartKey())) {
LOG.debug("Scanned region is no longer in map of online " + LOG.debug("Scanned region is no longer in map of online " +
"regions or its value has changed"); "regions or its value has changed");
return scanSuccessful; return false;
} }
// Make sure the file system is still available // Make sure the file system is still available
master.checkFileSystem(); master.checkFileSystem();
@ -94,7 +92,7 @@ class MetaScanner extends BaseScanner {
// at least log it rather than go out silently. // at least log it rather than go out silently.
LOG.error("Unexpected exception", e); LOG.error("Unexpected exception", e);
} }
return scanSuccessful; return true;
} }
@Override @Override
@ -125,22 +123,27 @@ class MetaScanner extends BaseScanner {
@Override @Override
protected void maintenanceScan() { protected void maintenanceScan() {
List<MetaRegion> regions = regionManager.getListOfOnlineMetaRegions(); List<MetaRegion> regions = regionManager.getListOfOnlineMetaRegions();
int regionCount = 0;
for (MetaRegion r: regions) { for (MetaRegion r: regions) {
scanOneMetaRegion(r); scanOneMetaRegion(r);
regionCount++;
} }
LOG.info("All " + regionCount + " .META. region(s) scanned");
metaRegionsScanned(); metaRegionsScanned();
} }
/** /*
* Called by the meta scanner when it has completed scanning all meta * Called by the meta scanner when it has completed scanning all meta
* regions. This wakes up any threads that were waiting for this to happen. * regions. This wakes up any threads that were waiting for this to happen.
* @param totalRows Total rows scanned.
* @param regionCount Count of regions in .META. table.
* @return False if number of meta regions matches count of online regions.
*/ */
private synchronized boolean metaRegionsScanned() { private synchronized boolean metaRegionsScanned() {
if (!regionManager.isInitialRootScanComplete() || if (!regionManager.isInitialRootScanComplete() ||
regionManager.numMetaRegions() != regionManager.numOnlineMetaRegions()) { regionManager.numMetaRegions() != regionManager.numOnlineMetaRegions()) {
return false; return false;
} }
LOG.info("all meta regions scanned");
notifyAll(); notifyAll();
return true; return true;
} }

View File

@ -36,14 +36,17 @@ class RootScanner extends BaseScanner {
super(master, regionManager, true, master.metaRescanInterval, master.closed); super(master, regionManager, true, master.metaRescanInterval, master.closed);
} }
// Don't retry if we get an error while scanning. Errors are most often /*
// caused by the server going away. Wait until next rescan interval when * Don't retry if we get an error while scanning. Errors are most often
// things should be back to normal *
* caused by the server going away. Wait until next rescan interval when
* things should be back to normal.
* @return True if successfully scanned.
*/
private boolean scanRoot() { private boolean scanRoot() {
boolean scanSuccessful = false;
master.waitForRootRegionLocation(); master.waitForRootRegionLocation();
if (master.closed.get()) { if (master.closed.get()) {
return scanSuccessful; return false;
} }
try { try {
@ -54,7 +57,6 @@ class RootScanner extends BaseScanner {
HRegionInfo.ROOT_REGIONINFO.getRegionName())); HRegionInfo.ROOT_REGIONINFO.getRegionName()));
} }
} }
scanSuccessful = true;
} catch (IOException e) { } catch (IOException e) {
e = RemoteExceptionHandler.checkIOException(e); e = RemoteExceptionHandler.checkIOException(e);
LOG.warn("Scan ROOT region", e); LOG.warn("Scan ROOT region", e);
@ -65,12 +67,12 @@ class RootScanner extends BaseScanner {
// at least log it rather than go out silently. // at least log it rather than go out silently.
LOG.error("Unexpected exception", e); LOG.error("Unexpected exception", e);
} }
return scanSuccessful; return true;
} }
@Override @Override
protected boolean initialScan() { protected boolean initialScan() {
initialScanComplete = scanRoot(); this.initialScanComplete = scanRoot();
return initialScanComplete; return initialScanComplete;
} }

View File

@ -87,7 +87,7 @@ class ServerManager implements HConstants {
master.getConfiguration().getInt("hbase.master.lease.thread.wakefrequency", master.getConfiguration().getInt("hbase.master.lease.thread.wakefrequency",
15 * 1000)); 15 * 1000));
this.loggingPeriodForAverageLoad = master.getConfiguration(). this.loggingPeriodForAverageLoad = master.getConfiguration().
getLong("hbase.master.avgload.logging.period", 15000); getLong("hbase.master.avgload.logging.period", 60000);
} }
/** /**

View File

@ -369,7 +369,7 @@ public class HRegion implements HConstants {
// Disable compacting and flushing by background threads for this // Disable compacting and flushing by background threads for this
// region. // region.
writestate.writesEnabled = false; writestate.writesEnabled = false;
LOG.debug("Compactions and cache flushes disabled for region " + this); LOG.debug("Closing " + this + ": compactions & flushes disabled ");
while (writestate.compacting || writestate.flushing) { while (writestate.compacting || writestate.flushing) {
LOG.debug("waiting for" + LOG.debug("waiting for" +
(writestate.compacting ? " compaction" : "") + (writestate.compacting ? " compaction" : "") +
@ -384,7 +384,6 @@ public class HRegion implements HConstants {
} }
} }
newScannerLock.writeLock().lock(); newScannerLock.writeLock().lock();
LOG.debug("Scanners disabled for region " + this);
try { try {
// Wait for active scanners to finish. The write lock we hold will // Wait for active scanners to finish. The write lock we hold will
// prevent new scanners from being created. // prevent new scanners from being created.
@ -399,9 +398,9 @@ public class HRegion implements HConstants {
} }
} }
} }
LOG.debug("No more active scanners for region " + this);
splitsAndClosesLock.writeLock().lock(); splitsAndClosesLock.writeLock().lock();
LOG.debug("Updates disabled for region " + this); LOG.debug("Updates disabled for region, no outstanding scanners on " +
this);
try { try {
// Write lock means no more row locks can be given out. Wait on // Write lock means no more row locks can be given out. Wait on
// outstanding row locks to come in before we close so we do not drop // outstanding row locks to come in before we close so we do not drop
@ -420,7 +419,7 @@ public class HRegion implements HConstants {
} }
this.closed.set(true); this.closed.set(true);
LOG.info("closed " + this); LOG.info("Closed " + this);
return result; return result;
} finally { } finally {
splitsAndClosesLock.writeLock().unlock(); splitsAndClosesLock.writeLock().unlock();