You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2011/07/16 02:28:27 UTC
svn commit: r1147350 - in /hbase/trunk: ./
src/main/java/org/apache/hadoop/hbase/regionserver/
src/test/java/org/apache/hadoop/hbase/coprocessor/
src/test/java/org/apache/hadoop/hbase/regionserver/
Author: stack
Date: Sat Jul 16 00:28:26 2011
New Revision: 1147350
URL: http://svn.apache.org/viewvc?rev=1147350&view=rev
Log:
HBASE-4081 Issues with HRegion.compactStores methods
Modified:
hbase/trunk/CHANGES.txt
hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorInterface.java
hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1147350&r1=1147349&r2=1147350&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Sat Jul 16 00:28:26 2011
@@ -314,6 +314,7 @@ Release 0.91.0 - Unreleased
HBASE-4054 Usability improvement to HTablePool (Daniel Iancu)
HBASE-4079 HTableUtil - helper class for loading data (Doug Meil via Ted Yu)
HBASE-3871 Speedup LoadIncrementalHFiles by parallelizing HFile splitting
+ HBASE-4081 Issues with HRegion.compactStores methods (Ming Ma)
TASKS
HBASE-3559 Move report of split to master OFF the heartbeat channel
Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=1147350&r1=1147349&r2=1147350&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java Sat Jul 16 00:28:26 2011
@@ -815,33 +815,27 @@ public class HRegion implements HeapSize
}
/**
- * Called by compaction thread and after region is opened to compact the
- * HStores if necessary.
- *
- * <p>This operation could block for a long time, so don't call it from a
- * time-sensitive thread.
- *
- * Note that no locking is necessary at this level because compaction only
- * conflicts with a region split, and that cannot happen because the region
- * server does them sequentially and not in parallel.
+ * This is a helper function that compact all the stores synchronously
+ * It is used by utilities and testing
*
* @param majorCompaction True to force a major compaction regardless of thresholds
- * @return split row if split is needed
* @throws IOException e
*/
- byte [] compactStores(final boolean majorCompaction)
+ void compactStores(final boolean majorCompaction)
throws IOException {
if (majorCompaction) {
this.triggerMajorCompaction();
}
- return compactStores();
+ compactStores();
}
/**
- * Compact all the stores and return the split key of the first store that needs
- * to be split.
+ * This is a helper function that compact all the stores synchronously
+ * It is used by utilities and testing
+ *
+ * @throws IOException e
*/
- public byte[] compactStores() throws IOException {
+ public void compactStores() throws IOException {
for(Store s : getStores().values()) {
CompactionRequest cr = s.requestCompaction();
if(cr != null) {
@@ -851,12 +845,7 @@ public class HRegion implements HeapSize
s.finishRequest(cr);
}
}
- byte[] splitRow = s.checkSplit();
- if (splitRow != null) {
- return splitRow;
- }
}
- return null;
}
/*
@@ -3829,7 +3818,7 @@ public class HRegion implements HeapSize
// nothing
}
- byte[] checkSplit() {
+ public byte[] checkSplit() {
if (this.splitPoint != null) {
return this.splitPoint;
}
Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorInterface.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorInterface.java?rev=1147350&r1=1147349&r2=1147350&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorInterface.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorInterface.java Sat Jul 16 00:28:26 2011
@@ -146,7 +146,11 @@ public class TestCoprocessorInterface ex
addContent(region, fam3);
region.flushcache();
}
- byte [] splitRow = region.compactStores();
+
+ region.compactStores();
+
+ byte [] splitRow = region.checkSplit();
+
assertNotNull(splitRow);
HRegion [] regions = split(region, splitRow);
for (int i = 0; i < regions.length; i++) {
Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java?rev=1147350&r1=1147349&r2=1147350&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java Sat Jul 16 00:28:26 2011
@@ -1290,7 +1290,8 @@ public class TestHRegion extends HBaseTe
try {
LOG.info("" + addContent(region, fam3));
region.flushcache();
- byte [] splitRow = region.compactStores();
+ region.compactStores();
+ byte [] splitRow = region.checkSplit();
assertNotNull(splitRow);
LOG.info("SplitRow: " + Bytes.toString(splitRow));
HRegion [] subregions = splitRegion(region, splitRow);
@@ -2295,7 +2296,8 @@ public class TestHRegion extends HBaseTe
try {
LOG.info("" + addContent(region, fam3));
region.flushcache();
- byte [] splitRow = region.compactStores();
+ region.compactStores();
+ byte [] splitRow = region.checkSplit();
assertNotNull(splitRow);
LOG.info("SplitRow: " + Bytes.toString(splitRow));
HRegion [] regions = splitRegion(region, splitRow);
@@ -2329,7 +2331,8 @@ public class TestHRegion extends HBaseTe
byte [][] midkeys = new byte [regions.length][];
// To make regions splitable force compaction.
for (int i = 0; i < regions.length; i++) {
- midkeys[i] = regions[i].compactStores();
+ regions[i].compactStores();
+ midkeys[i] = regions[i].checkSplit();
}
TreeMap<String, HRegion> sortedMap = new TreeMap<String, HRegion>();