You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by la...@apache.org on 2015/03/18 21:57:36 UTC
hbase git commit: HBASE-11195 Potentially improve block locality
during major compaction for old regions. (churro morales)
Repository: hbase
Updated Branches:
refs/heads/0.94 36c8f075f -> 459fc00ed
HBASE-11195 Potentially improve block locality during major compaction for old regions. (churro morales)
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/459fc00e
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/459fc00e
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/459fc00e
Branch: refs/heads/0.94
Commit: 459fc00ed8ae048efca737c90559a1b0e47bf300
Parents: 36c8f07
Author: Lars Hofhansl <la...@apache.org>
Authored: Wed Mar 18 13:56:43 2015 -0700
Committer: Lars Hofhansl <la...@apache.org>
Committed: Wed Mar 18 13:56:43 2015 -0700
----------------------------------------------------------------------
.../apache/hadoop/hbase/regionserver/Store.java | 37 ++++++++++++++------
1 file changed, 27 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/459fc00e/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java b/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java
index 46b4e52..1fdbdac 100644
--- a/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java
+++ b/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java
@@ -106,7 +106,7 @@ import com.google.common.collect.Lists;
*/
public class Store extends SchemaConfigured implements HeapSize {
static final Log LOG = LogFactory.getLog(Store.class);
-
+
public static final String BLOCKING_STOREFILES_KEY = "hbase.hstore.blockingStoreFiles";
public static final int DEFAULT_BLOCKING_STOREFILE_COUNT = 7;
@@ -124,6 +124,7 @@ public class Store extends SchemaConfigured implements HeapSize {
private final int maxFilesToCompact;
private final long minCompactSize;
private final long maxCompactSize;
+ private final float minStoreFileLocalitySkipCompact;
private long lastCompactSize = 0;
volatile boolean forceMajor = false;
/* how many bytes to write between status checks */
@@ -241,6 +242,8 @@ public class Store extends SchemaConfigured implements HeapSize {
this.region.memstoreFlushSize);
this.maxCompactSize
= conf.getLong("hbase.hstore.compaction.max.size", Long.MAX_VALUE);
+ this.minStoreFileLocalitySkipCompact
+ = conf.getFloat("hbase.hstore.min.locality.to.skip.major.compact", 0f);
this.verifyBulkLoads = conf.getBoolean("hbase.hstore.bulkload.verify", false);
@@ -1326,17 +1329,31 @@ public class Store extends SchemaConfigured implements HeapSize {
(sf.getReader().timeRangeTracker == null) ?
Long.MIN_VALUE :
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 +
- " because one (major) compacted file only and oldestTime " +
- oldest + "ms is < ttl=" + this.ttl);
+ if (sf.isMajorCompaction() && (this.ttl == HConstants.FOREVER || oldest < this.ttl)) {
+ // if there is only one old store file, only compact if dfs blocks are not local.
+ float blockLocalityIndex = sf.getHDFSBlockDistribution().getBlockLocalityIndex(
+ region.getRegionServerServices().getServerName().getHostname()
+ );
+ if (blockLocalityIndex < minStoreFileLocalitySkipCompact) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Major compaction triggered on only store " + this +
+ "; to make hdfs blocks local, current locality: " + blockLocalityIndex
+ );
+ }
+ result = true;
+ } else {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Skipping major compaction of " + this +
+ " because one (major) compacted file only and oldestTime " +
+ oldest + "ms is < ttl=" + this.ttl);
+ }
}
} else if (this.ttl != HConstants.FOREVER && oldest > this.ttl) {
- LOG.debug("Major compaction triggered on store " + this +
- ", because keyvalues outdated; time since last major compaction " +
- (now - lowTimestamp) + "ms");
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Major compaction triggered on store " + this +
+ ", because keyvalues outdated; time since last major compaction " +
+ (now - lowTimestamp) + "ms");
+ }
result = true;
}
} else {