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:18:34 UTC
svn commit: r1181544 - in
/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver:
CompactSplitThread.java compactions/CompactionRequest.java
Author: nspiegelberg
Date: Tue Oct 11 02:18:33 2011
New Revision: 1181544
URL: http://svn.apache.org/viewvc?rev=1181544&view=rev
Log:
Hotfix: compaction requests on RS startup
Summary:
Fix for high StoreFile count on prod cluster. Some of the compactions issued
when starting the RS were being silently ignored and never freed due to an NPE
bug with HRegion.getRegionServer() that was issued out the try block.
Test Plan:
- mvn test -Dtest=TestCompaction
- dark launch testing
Reviewed By: kannan
Reviewers: kannan, mbautin
CC: nspiegelberg, kannan
Differential Revision: 255550
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/compactions/CompactionRequest.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=1181544&r1=1181543&r2=1181544&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:18:33 2011
@@ -58,6 +58,7 @@ public class CompactSplitThread {
super();
this.server = server;
this.conf = server.conf;
+ Preconditions.checkArgument(this.server != null && this.conf != null);
int largeThreads = Math.max(1, conf.getInt(
"hbase.regionserver.thread.compaction.large", 1));
@@ -157,6 +158,7 @@ public class CompactSplitThread {
CompactionRequest cr = s.requestCompaction();
if (cr != null) {
+ cr.setServer(this.server);
if (priority != NO_PRIORITY) {
cr.setPriority(priority);
}
Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionRequest.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionRequest.java?rev=1181544&r1=1181543&r2=1181544&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionRequest.java (original)
+++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionRequest.java Tue Oct 11 02:18:33 2011
@@ -35,6 +35,7 @@ public class CompactionRequest implement
private final boolean isMajor;
private int p;
private final Date date;
+ private HRegionServer server = null;
public CompactionRequest(HRegion r, Store s,
List<StoreFile> files, boolean isMajor, int p) {
@@ -111,6 +112,10 @@ public class CompactionRequest implement
return this.isMajor;
}
+ public void setServer(HRegionServer server) {
+ this.server = server;
+ }
+
/** Gets the priority for the request */
public int getPriority() {
return p;
@@ -147,11 +152,10 @@ public class CompactionRequest implement
@Override
public void run() {
- HRegionServer server = this.r.getRegionServer();
- if (server.isStopRequested()) {
- return;
- }
try {
+ if (server.isStopRequested()) {
+ return;
+ }
long start = EnvironmentEdgeManager.currentTimeMillis();
boolean completed = r.compact(this);
long now = EnvironmentEdgeManager.currentTimeMillis();
@@ -168,13 +172,19 @@ public class CompactionRequest implement
} catch (IOException ex) {
LOG.error("Compaction failed " + this, RemoteExceptionHandler
.checkIOException(ex));
- server.checkFileSystem();
+ if (server != null) {
+ server.checkFileSystem();
+ }
} catch (Exception ex) {
LOG.error("Compaction failed " + this, ex);
- server.checkFileSystem();
+ if (server != null) {
+ server.checkFileSystem();
+ }
} finally {
s.finishRequest(this);
- LOG.debug("CompactSplitThread Status: " + server.compactSplitThread);
+ if (server != null) {
+ LOG.debug("CompactSplitThread Status: " + server.compactSplitThread);
+ }
}
}