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
hbasefsck.
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

View File

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