HBASE-1816 Master rewrite; should have removed safe-mode from regionserver-side too -- Needed to remove the wait up in top of flush and compactions threads-- used to wait on safe mode... was stuck there...

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@830844 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2009-10-29 04:42:15 +00:00
parent c7df216c11
commit b58a646039
4 changed files with 7 additions and 75 deletions

View File

@ -70,13 +70,6 @@ class CompactSplitThread extends Thread implements HConstants {
@Override
public void run() {
while (!this.server.isStopRequested()) {
try {
Thread.sleep(this.frequency);
} catch (InterruptedException ex) {
continue;
}
}
int count = 0;
while (!this.server.isStopRequested()) {
HRegion r = null;

View File

@ -202,9 +202,6 @@ public class HRegionServer implements HConstants, HRegionInterface,
// eclipse warning when accessed by inner classes
protected volatile HLog hlog;
LogRoller hlogRoller;
// limit compactions while starting up
CompactionLimitThread compactionLimitThread;
// flag set after we're done setting up server threads (used for testing)
protected volatile boolean isOnline;
@ -858,48 +855,6 @@ public class HRegionServer implements HConstants, HRegionInterface,
return this.fsOk;
}
/**
* Thread that gradually ups compaction limit.
*/
private class CompactionLimitThread extends Thread {
protected CompactionLimitThread() {}
@Override
public void run() {
// Slowly increase per-cycle compaction limit, finally setting it to
// unlimited (-1)
int compactionCheckInterval =
conf.getInt("hbase.regionserver.thread.splitcompactcheckfrequency",
20 * 1000);
final int limitSteps[] = {
1, 1, 1, 1,
2, 2, 2, 2, 2, 2,
3, 3, 3, 3, 3, 3, 3, 3,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
-1
};
for (int i = 0; i < limitSteps.length; i++) {
// Just log changes.
if (compactSplitThread.getLimit() != limitSteps[i] &&
LOG.isDebugEnabled()) {
LOG.debug("setting compaction limit to " + limitSteps[i]);
}
compactSplitThread.setLimit(limitSteps[i]);
try {
Thread.sleep(compactionCheckInterval);
} catch (InterruptedException ex) {
// unlimit compactions before exiting
compactSplitThread.setLimit(-1);
if (LOG.isDebugEnabled()) {
LOG.debug(this.getName() + " exiting on interrupt");
}
return;
}
}
LOG.info("compactions no longer limited");
}
}
/*
* Thread to shutdown the region server in an orderly manner. This thread
* is registered as a shutdown hook in the HRegionServer constructor and is
@ -1130,10 +1085,6 @@ public class HRegionServer implements HConstants, HRegionInterface,
}
}
this.compactionLimitThread = new CompactionLimitThread();
Threads.setDaemonThreadRunning(this.compactionLimitThread, n +
".compactionLimitThread", handler);
// Start Server. This service is like leases in that it internally runs
// a thread.
this.server.start();
@ -2083,7 +2034,7 @@ public class HRegionServer implements HConstants, HRegionInterface,
* @return true if a stop has been requested.
*/
public boolean isStopRequested() {
return stopRequested.get();
return this.stopRequested.get();
}
/**

View File

@ -133,16 +133,9 @@ class MemStoreFlusher extends Thread implements FlushRequester {
@Override
public void run() {
while (!this.server.isStopRequested()) {
try {
Thread.sleep(threadWakeFrequency);
} catch (InterruptedException ex) {
continue;
}
}
while (!server.isStopRequested()) {
HRegion r = null;
try {
r = flushQueue.poll(threadWakeFrequency, TimeUnit.MILLISECONDS);
r = this.flushQueue.poll(this.threadWakeFrequency, TimeUnit.MILLISECONDS);
if (r == null) {
continue;
}
@ -162,8 +155,8 @@ class MemStoreFlusher extends Thread implements FlushRequester {
}
}
}
regionsInQueue.clear();
flushQueue.clear();
this.regionsInQueue.clear();
this.flushQueue.clear();
LOG.info(getName() + " exiting");
}

View File

@ -99,7 +99,6 @@ public class TestLogRolling extends HBaseClusterTestCase {
private void startAndWriteData() throws Exception {
// When the META table can be opened, the region servers are running
new HTable(conf, HConstants.META_TABLE_NAME);
this.server = cluster.getRegionThreads().get(0).getRegionServer();
this.log = server.getLog();
@ -109,15 +108,12 @@ public class TestLogRolling extends HBaseClusterTestCase {
HBaseAdmin admin = new HBaseAdmin(conf);
admin.createTable(desc);
HTable table = new HTable(conf, tableName);
for (int i = 1; i <= 256; i++) { // 256 writes should cause 8 log rolls
Put put = new Put(Bytes.toBytes("row" + String.format("%1$04d", i)));
put.add(HConstants.CATALOG_FAMILY, null, value);
table.put(put);
if (i % 32 == 0) {
// After every 32 writes sleep to let the log roller run
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
@ -126,14 +122,14 @@ public class TestLogRolling extends HBaseClusterTestCase {
}
}
}
/**
* Tests that logs are deleted
*
* @throws Exception
*/
public void testLogRolling() throws Exception {
tableName = getName();
this.tableName = getName();
try {
startAndWriteData();
LOG.info("after writing there are " + log.getNumLogFiles() + " log files");
@ -158,5 +154,4 @@ public class TestLogRolling extends HBaseClusterTestCase {
throw e;
}
}
}
}