You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ji...@apache.org on 2016/12/12 03:59:55 UTC
hbase git commit: HBASE-17237 Override the correct compact method in
HMobStore
Repository: hbase
Updated Branches:
refs/heads/master c24a055db -> 1615f45b3
HBASE-17237 Override the correct compact method in HMobStore
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/1615f45b
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/1615f45b
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/1615f45b
Branch: refs/heads/master
Commit: 1615f45b31f4a8ae2344c1b3b2534f151141fa5d
Parents: c24a055
Author: Jingcheng Du <ji...@apache.org>
Authored: Mon Dec 12 11:54:21 2016 +0800
Committer: Jingcheng Du <ji...@apache.org>
Committed: Mon Dec 12 11:54:21 2016 +0800
----------------------------------------------------------------------
.../hadoop/hbase/regionserver/HMobStore.java | 31 +++++++++-----------
.../hbase/regionserver/TestHMobStore.java | 2 +-
.../hadoop/hbase/regionserver/TestStore.java | 2 +-
3 files changed, 16 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/1615f45b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HMobStore.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HMobStore.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HMobStore.java
index 929309e..0bf6c9a 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HMobStore.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HMobStore.java
@@ -62,6 +62,7 @@ import org.apache.hadoop.hbase.mob.MobStoreEngine;
import org.apache.hadoop.hbase.mob.MobUtils;
import org.apache.hadoop.hbase.regionserver.compactions.CompactionContext;
import org.apache.hadoop.hbase.regionserver.throttle.ThroughputController;
+import org.apache.hadoop.hbase.security.User;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
import org.apache.hadoop.hbase.util.HFileArchiveUtil;
@@ -463,28 +464,24 @@ public class HMobStore extends HStore {
}
/**
- * The compaction in the store of mob.
+ * The compaction in the mob store.
* The cells in this store contains the path of the mob files. There might be race
- * condition between the major compaction and the sweeping in mob files.
- * In order to avoid this, we need mutually exclude the running of the major compaction and
- * sweeping in mob files.
+ * condition between the major compaction and the mob major compaction.
+ * In order to avoid this, we need mutually exclude the running of the major compaction
+ * and the mob major compaction.
* The minor compaction is not affected.
- * The major compaction is marked as retainDeleteMarkers when a sweeping is in progress.
+ * The major compaction is marked as retainDeleteMarkers when a mob major
+ * compaction is in progress.
*/
@Override
public List<StoreFile> compact(CompactionContext compaction,
- ThroughputController throughputController) throws IOException {
- // If it's major compaction, try to find whether there's a sweeper is running
+ ThroughputController throughputController, User user) throws IOException {
+ // If it's major compaction, try to find whether there's a mob major compaction is running
// If yes, mark the major compaction as retainDeleteMarkers
if (compaction.getRequest().isAllFiles()) {
- // Use the ZooKeeper to coordinate.
- // 1. Acquire a operation lock.
- // 1.1. If no, mark the major compaction as retainDeleteMarkers and continue the compaction.
- // 1.2. If the lock is obtained, search the node of sweeping.
- // 1.2.1. If the node is there, the sweeping is in progress, mark the major
- // compaction as retainDeleteMarkers and continue the compaction.
- // 1.2.2. If the node is not there, add a child to the major compaction node, and
- // run the compaction directly.
+ // Acquire a table lock to coordinate.
+ // 1. If no, mark the major compaction as retainDeleteMarkers and continue the compaction.
+ // 2. If the lock is obtained, run the compaction directly.
TableLock lock = null;
if (tableLockManager != null) {
lock = tableLockManager.readLock(tableLockName, "Major compaction in HMobStore");
@@ -510,7 +507,7 @@ public class HMobStore extends HStore {
+ tableName + "], forcing the delete markers to be retained");
compaction.getRequest().forceRetainDeleteMarkers();
}
- return super.compact(compaction, throughputController);
+ return super.compact(compaction, throughputController, user);
} finally {
if (tableLocked && lock != null) {
try {
@@ -522,7 +519,7 @@ public class HMobStore extends HStore {
}
} else {
// If it's not a major compaction, continue the compaction.
- return super.compact(compaction, throughputController);
+ return super.compact(compaction, throughputController, user);
}
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/1615f45b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHMobStore.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHMobStore.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHMobStore.java
index 41879e9..2accf41 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHMobStore.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHMobStore.java
@@ -537,7 +537,7 @@ public class TestHMobStore {
// Trigger major compaction
this.store.triggerMajorCompaction();
CompactionContext requestCompaction = this.store.requestCompaction(1, null);
- this.store.compact(requestCompaction, NoLimitThroughputController.INSTANCE);
+ this.store.compact(requestCompaction, NoLimitThroughputController.INSTANCE, null);
Assert.assertEquals(1, this.store.getStorefiles().size());
//Check encryption after compaction
http://git-wip-us.apache.org/repos/asf/hbase/blob/1615f45b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStore.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStore.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStore.java
index 3f05381..46c1dd5 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStore.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStore.java
@@ -381,7 +381,7 @@ public class TestStore {
Assert.assertEquals(lowestTimeStampFromManager,lowestTimeStampFromFS);
// after compact; check the lowest time stamp
- store.compact(store.requestCompaction(), NoLimitThroughputController.INSTANCE);
+ store.compact(store.requestCompaction(), NoLimitThroughputController.INSTANCE, null);
lowestTimeStampFromManager = StoreUtils.getLowestTimestamp(store.getStorefiles());
lowestTimeStampFromFS = getLowestTimeStampFromFS(fs, store.getStorefiles());
Assert.assertEquals(lowestTimeStampFromManager, lowestTimeStampFromFS);