HBASE-1083 Will keep scheduling major compactions if last time one ran, we didn't.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@731748 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2009-01-05 22:32:37 +00:00
parent 18f3f2269b
commit 84b7463032
4 changed files with 28 additions and 21 deletions

View File

@ -128,6 +128,8 @@ Release 0.19.0 - Unreleased
HBASE-1097 SequenceFile.Reader keeps around buffer whose size is that of
largest item read -> results in lots of dead heap
HBASE-1107 NPE in HStoreScanner.updateReaders
HBASE-1083 Will keep scheduling major compactions if last time one ran, we
didn't.
IMPROVEMENTS
HBASE-901 Add a limit to key length, check key and value length on client side

View File

@ -143,7 +143,8 @@ class CompactSplitThread extends Thread implements HConstants {
return;
}
LOG.debug("Compaction requested for region " +
Bytes.toString(r.getRegionName()) +
Bytes.toString(r.getRegionName()) + "/" +
r.getRegionInfo().getEncodedName() +
(why != null && !why.isEmpty()? " because: " + why: ""));
synchronized (regionsInQueue) {
if (!regionsInQueue.contains(r)) {

View File

@ -966,7 +966,12 @@ public class HStore implements HConstants {
* @return True if we should run a major compaction.
*/
boolean isMajorCompaction() throws IOException {
return isMajorCompaction(null);
List<HStoreFile> filesToCompact = null;
synchronized (storefiles) {
// filesToCompact are sorted oldest to newest.
filesToCompact = new ArrayList<HStoreFile>(this.storefiles.values());
}
return isMajorCompaction(filesToCompact);
}
/*
@ -977,25 +982,24 @@ public class HStore implements HConstants {
throws IOException {
boolean result = false;
Path mapdir = HStoreFile.getMapDir(this.basedir, this.info.getEncodedName(),
this.family.getName());
this.family.getName());
long lowTimestamp = getLowestTimestamp(fs, mapdir);
if (lowTimestamp < (System.currentTimeMillis() - this.majorCompactionTime) &&
lowTimestamp > 0l) {
long now = System.currentTimeMillis();
if (lowTimestamp > 0l && lowTimestamp < (now - this.majorCompactionTime)) {
// Major compaction time has elapsed.
long elapsedTime = System.currentTimeMillis() - lowTimestamp;
long elapsedTime = now - lowTimestamp;
if (filesToCompact != null && filesToCompact.size() == 1 &&
filesToCompact.get(0).isMajorCompaction() &&
(this.ttl == HConstants.FOREVER || elapsedTime < this.ttl)) {
if (LOG.isDebugEnabled()) {
LOG.debug("Skipping major compaction because only one (major) " +
"compacted file only and elapsedTime " + elapsedTime +
" is < ttl=" + this.ttl);
LOG.debug("Skipping major compaction of " + this.storeNameStr +
" because one (major) compacted file only and elapsedTime " +
elapsedTime + "ms is < ttl=" + this.ttl);
}
} else {
if (LOG.isDebugEnabled()) {
LOG.debug("Major compaction triggered on store: " +
this.storeNameStr + ". Time since last major compaction: " +
((System.currentTimeMillis() - lowTimestamp)/1000) + " seconds");
LOG.debug("Major compaction triggered on store " + this.storeNameStr +
"; time since last major compaction " + (now - lowTimestamp) + "ms");
}
result = true;
}

View File

@ -10,8 +10,8 @@ Automatically created by Tomcat JspC.
<servlet>
<servlet-name>org.apache.hadoop.hbase.generated.master.master_jsp</servlet-name>
<servlet-class>org.apache.hadoop.hbase.generated.master.master_jsp</servlet-class>
<servlet-name>org.apache.hadoop.hbase.generated.master.table_jsp</servlet-name>
<servlet-class>org.apache.hadoop.hbase.generated.master.table_jsp</servlet-class>
</servlet>
<servlet>
@ -20,13 +20,13 @@ Automatically created by Tomcat JspC.
</servlet>
<servlet>
<servlet-name>org.apache.hadoop.hbase.generated.master.table_jsp</servlet-name>
<servlet-class>org.apache.hadoop.hbase.generated.master.table_jsp</servlet-class>
<servlet-name>org.apache.hadoop.hbase.generated.master.master_jsp</servlet-name>
<servlet-class>org.apache.hadoop.hbase.generated.master.master_jsp</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>org.apache.hadoop.hbase.generated.master.master_jsp</servlet-name>
<url-pattern>/master.jsp</url-pattern>
<servlet-name>org.apache.hadoop.hbase.generated.master.table_jsp</servlet-name>
<url-pattern>/table.jsp</url-pattern>
</servlet-mapping>
<servlet-mapping>
@ -35,8 +35,8 @@ Automatically created by Tomcat JspC.
</servlet-mapping>
<servlet-mapping>
<servlet-name>org.apache.hadoop.hbase.generated.master.table_jsp</servlet-name>
<url-pattern>/table.jsp</url-pattern>
<servlet-name>org.apache.hadoop.hbase.generated.master.master_jsp</servlet-name>
<url-pattern>/master.jsp</url-pattern>
</servlet-mapping>
</web-app>