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 2008/05/08 01:22:06 UTC
svn commit: r654321 - in /hadoop/hbase/branches/0.1: CHANGES.txt
src/java/org/apache/hadoop/hbase/HRegion.java
src/java/org/apache/hadoop/hbase/HStore.java
Author: stack
Date: Wed May 7 16:22:05 2008
New Revision: 654321
URL: http://svn.apache.org/viewvc?rev=654321&view=rev
Log:
HBASE-620 testmergetool failing in branch and trunk since hbase-618 went in
Modified:
hadoop/hbase/branches/0.1/CHANGES.txt
hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HRegion.java
hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HStore.java
Modified: hadoop/hbase/branches/0.1/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.1/CHANGES.txt?rev=654321&r1=654320&r2=654321&view=diff
==============================================================================
--- hadoop/hbase/branches/0.1/CHANGES.txt (original)
+++ hadoop/hbase/branches/0.1/CHANGES.txt Wed May 7 16:22:05 2008
@@ -33,6 +33,7 @@
HBASE-478 offlining of table does not run reliably
HBASE-618 We always compact if 2 files, regardless of the compaction threshold setting
HBASE-619 Fix 'logs' link in UI
+ HBASE-620 testmergetool failing in branch and trunk since hbase-618 went in
IMPROVEMENTS
HBASE-559 MR example job to count table rows
Modified: hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HRegion.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HRegion.java?rev=654321&r1=654320&r2=654321&view=diff
==============================================================================
--- hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HRegion.java (original)
+++ hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HRegion.java Wed May 7 16:22:05 2008
@@ -146,12 +146,12 @@
// Compact each region so we only have one store file per family
- a.compactStores();
+ a.compactStores(true);
if (LOG.isDebugEnabled()) {
LOG.debug("Files for region: " + a.getRegionName());
listPaths(fs, a.getRegionDir());
}
- b.compactStores();
+ b.compactStores(true);
if (LOG.isDebugEnabled()) {
LOG.debug("Files for region: " + b.getRegionName());
listPaths(fs, b.getRegionDir());
@@ -896,7 +896,6 @@
this.fs.delete(this.regionCompactionDir);
}
}
-
/**
* Compact all the stores. This should be called periodically to make sure
* the stores are kept manageable.
@@ -912,10 +911,33 @@
* 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.
- *
* @throws IOException
*/
public boolean compactStores() throws IOException {
+ return compactStores(false);
+ }
+
+ /*
+ * Compact all the stores. This should be called periodically to make sure
+ * the stores are kept manageable.
+ *
+ * <p>This operation could block for a long time, so don't call it from a
+ * time-sensitive thread.
+ *
+ * @return Returns TRUE if the compaction has completed. FALSE, if the
+ * compaction was not carried out, because the HRegion is busy doing
+ * something else storage-intensive (like flushing the cache). The caller
+ * should check back later.
+ *
+ * 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.
+ *
+ * @param force True to force a compaction regardless of thresholds (Needed
+ * by merge).
+ * @throws IOException
+ */
+ private boolean compactStores(final boolean force) throws IOException {
if (this.closed.get()) {
return false;
}
@@ -936,7 +958,7 @@
boolean status = true;
doRegionCompactionPrep();
for (HStore store : stores.values()) {
- if(!store.compact()) {
+ if(!store.compact(force)) {
status = false;
}
}
Modified: hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HStore.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HStore.java?rev=654321&r1=654320&r2=654321&view=diff
==============================================================================
--- hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HStore.java (original)
+++ hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HStore.java Wed May 7 16:22:05 2008
@@ -1359,10 +1359,11 @@
* We don't want to hold the structureLock for the whole time, as a compact()
* can be lengthy and we want to allow cache-flushes during this period.
* @throws IOException
- *
+ * @param force True to force a compaction regardless of thresholds (Needed
+ * by merge).
* @return true if compaction completed successfully
*/
- boolean compact() throws IOException {
+ boolean compact(final boolean force) throws IOException {
synchronized (compactLock) {
// Storefiles are keyed by sequence id. The oldest file comes first.
// We need to return out of here a List that has the newest file first.
@@ -1371,7 +1372,7 @@
if (filesToCompact.size() == 0) {
return true;
}
- if (!hasReferences(filesToCompact) &&
+ if (!force && !hasReferences(filesToCompact) &&
filesToCompact.size() < compactionThreshold) {
return false;
}