You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ns...@apache.org on 2011/10/11 04:04:53 UTC
svn commit: r1181393 - in /hbase/branches/0.89/src:
main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
main/java/org/apache/hadoop/hbase/regionserver/Store.java
test/java/org/apache/hadoop/hbase/regionserver/TestCompaction.java
Author: nspiegelberg
Date: Tue Oct 11 02:04:50 2011
New Revision: 1181393
URL: http://svn.apache.org/viewvc?rev=1181393&view=rev
Log:
HBASE-3043 : Trivial changes per OpenSource peer view + fix TestHeapSize
Modified:
hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java
hbase/branches/0.89/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompaction.java
Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java?rev=1181393&r1=1181392&r2=1181393&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java (original)
+++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java Tue Oct 11 02:04:50 2011
@@ -95,16 +95,18 @@ class CompactSplitThread extends Thread
HRegion r = null;
try {
r = compactionQueue.poll(this.frequency, TimeUnit.MILLISECONDS);
- if (r != null && !this.server.isStopRequested()) {
+ if (r != null) {
lock.lock();
try {
- // Don't interrupt us while we are working
- byte [] midKey = r.compactStores();
- LOG.debug("Just finished a compaction. " +
- " Current Compaction Queue Size: " +
- getCompactionQueueSize());
- if (midKey != null && !this.server.isStopRequested()) {
- split(r, midKey);
+ if(!this.server.isStopRequested()) {
+ // Don't interrupt us while we are working
+ byte [] midKey = r.compactStores();
+ LOG.debug("Just finished a compaction. " +
+ " Current Compaction Queue Size: " +
+ getCompactionQueueSize());
+ if (midKey != null && !this.server.isStopRequested()) {
+ split(r, midKey);
+ }
}
} finally {
lock.unlock();
Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java?rev=1181393&r1=1181392&r2=1181393&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java (original)
+++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java Tue Oct 11 02:04:50 2011
@@ -95,7 +95,7 @@ public class Store implements HeapSize {
private long majorCompactionTime;
private int maxFilesToCompact;
/* how many bytes to write between status checks */
- int closeCheckInterval;
+ static int closeCheckInterval = 0;
private final long desiredMaxFileSize;
private volatile long storeSize = 0L;
private final Object flushLock = new Object();
@@ -190,8 +190,10 @@ public class Store implements HeapSize {
}
this.maxFilesToCompact = conf.getInt("hbase.hstore.compaction.max", 10);
- this.closeCheckInterval = conf.getInt(
- "hbase.hstore.close.check.interval", 10*1000*1000 /* 10 MB */);
+ if (Store.closeCheckInterval == 0) {
+ Store.closeCheckInterval = conf.getInt(
+ "hbase.hstore.close.check.interval", 10*1000*1000 /* 10 MB */);
+ }
this.storefiles = sortAndClone(loadStoreFiles());
}
@@ -820,9 +822,9 @@ public class Store implements HeapSize {
writer.append(kv);
// check periodically to see if a system stop is requested
- if (this.closeCheckInterval > 0) {
+ if (Store.closeCheckInterval > 0) {
bytesWritten += kv.getLength();
- if (bytesWritten > this.closeCheckInterval) {
+ if (bytesWritten > Store.closeCheckInterval) {
bytesWritten = 0;
if (!this.region.areWritesEnabled()) {
writer.close();
@@ -855,9 +857,9 @@ public class Store implements HeapSize {
writer.append(kv);
// check periodically to see if a system stop is requested
- if (this.closeCheckInterval > 0) {
+ if (Store.closeCheckInterval > 0) {
bytesWritten += kv.getLength();
- if (bytesWritten > this.closeCheckInterval) {
+ if (bytesWritten > Store.closeCheckInterval) {
bytesWritten = 0;
if (!this.region.areWritesEnabled()) {
writer.close();
Modified: hbase/branches/0.89/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompaction.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompaction.java?rev=1181393&r1=1181392&r2=1181393&view=diff
==============================================================================
--- hbase/branches/0.89/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompaction.java (original)
+++ hbase/branches/0.89/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompaction.java Tue Oct 11 02:04:50 2011
@@ -248,9 +248,8 @@ public class TestCompaction extends HBas
assertEquals(0, count());
// lower the polling interval for this test
- Store s = r.stores.get(COLUMN_FAMILY);
- int origWI = s.closeCheckInterval;
- s.closeCheckInterval = 10*1000; // 10 KB
+ int origWI = Store.closeCheckInterval;
+ Store.closeCheckInterval = 10*1000; // 10 KB
try {
// Create a couple store files w/ 15KB (over 10KB interval)
@@ -279,6 +278,7 @@ public class TestCompaction extends HBas
spyR.compactStores();
// ensure that the compaction stopped, all old files are intact,
+ Store s = r.stores.get(COLUMN_FAMILY);
assertEquals(COMPACTION_THRESHOLD, s.getStorefilesCount());
assertTrue(s.getStorefilesSize() > 15*1000);
// and no new store files persisted past compactStores()
@@ -288,7 +288,7 @@ public class TestCompaction extends HBas
} finally {
// don't mess up future tests
r.writestate.writesEnabled = true;
- s.closeCheckInterval = origWI;
+ Store.closeCheckInterval = origWI;
// Delete all Store information once done using
for (int i = 0; i < COMPACTION_THRESHOLD; i++) {