HBASE-3083: Major compaction check should use new timestamp meta information in HFiles (rather than dfs timestamp) along with TTL to allow major even if single file

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1032649 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Gray 2010-11-08 17:49:58 +00:00
parent 4a4df61776
commit 160395c9f7
2 changed files with 15 additions and 8 deletions

View File

@ -1115,6 +1115,9 @@ Release 0.90.0 - Unreleased
HBASE-3201 Add accounting of empty regioninfo_qualifier rows in meta to HBASE-3201 Add accounting of empty regioninfo_qualifier rows in meta to
hbasefsck. hbasefsck.
HBASE-3048 unify code for major/minor compactions (Amit via jgray) HBASE-3048 unify code for major/minor compactions (Amit via jgray)
HBASE-3083 Major compaction check should use new timestamp meta
information in HFiles (rather than dfs timestamp) along with
TTL to allow major even if single file
NEW FEATURES NEW FEATURES

View File

@ -785,19 +785,23 @@ public class Store implements HeapSize {
majorCompactionTime == 0) { majorCompactionTime == 0) {
return result; return result;
} }
// TODO: Use better method for determining stamp of last major (HBASE-2990)
long lowTimestamp = getLowestTimestamp(fs, long lowTimestamp = getLowestTimestamp(fs,
filesToCompact.get(0).getPath().getParent()); filesToCompact.get(0).getPath().getParent());
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
if (lowTimestamp > 0l && lowTimestamp < (now - this.majorCompactionTime)) { if (lowTimestamp > 0l && lowTimestamp < (now - this.majorCompactionTime)) {
// Major compaction time has elapsed. // Major compaction time has elapsed.
long elapsedTime = now - lowTimestamp; if (filesToCompact.size() == 1) {
if (filesToCompact.size() == 1 && // Single file
filesToCompact.get(0).isMajorCompaction() && StoreFile sf = filesToCompact.get(0);
(this.ttl == HConstants.FOREVER || elapsedTime < this.ttl)) { long oldest = now - sf.getReader().timeRangeTracker.minimumTimestamp;
if (sf.isMajorCompaction() &&
(this.ttl == HConstants.FOREVER || oldest < this.ttl)) {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("Skipping major compaction of " + this.storeNameStr + LOG.debug("Skipping major compaction of " + this.storeNameStr +
" because one (major) compacted file only and elapsedTime " + " because one (major) compacted file only and oldestTime " +
elapsedTime + "ms is < ttl=" + this.ttl); oldest + "ms is < ttl=" + this.ttl);
}
} }
} else { } else {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {