hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r731748 - in /hadoop/hbase/trunk: CHANGES.txt src/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java src/java/org/apache/hadoop/hbase/regionserver/HStore.java src/webapps/master/WEB-INF/web.xml
Date Mon, 05 Jan 2009 22:32:37 GMT
Author: stack
Date: Mon Jan  5 14:32:37 2009
New Revision: 731748

URL: http://svn.apache.org/viewvc?rev=731748&view=rev
Log:
HBASE-1083 Will keep scheduling major compactions if last time one ran, we didn't.

Modified:
    hadoop/hbase/trunk/CHANGES.txt
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HStore.java
    hadoop/hbase/trunk/src/webapps/master/WEB-INF/web.xml

Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=731748&r1=731747&r2=731748&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Mon Jan  5 14:32:37 2009
@@ -128,6 +128,8 @@
    HBASE-1097  SequenceFile.Reader keeps around buffer whose size is that of
                largest item read -> results in lots of dead heap
    HBASE-1107  NPE in HStoreScanner.updateReaders
+   HBASE-1083  Will keep scheduling major compactions if last time one ran, we
+               didn't.
 
   IMPROVEMENTS
    HBASE-901   Add a limit to key length, check key and value length on client side

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java?rev=731748&r1=731747&r2=731748&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
(original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
Mon Jan  5 14:32:37 2009
@@ -143,7 +143,8 @@
       return;
     }
     LOG.debug("Compaction requested for region " +
-      Bytes.toString(r.getRegionName()) +
+      Bytes.toString(r.getRegionName()) + "/" +
+      r.getRegionInfo().getEncodedName() +
       (why != null && !why.isEmpty()? " because: " + why: ""));
     synchronized (regionsInQueue) {
       if (!regionsInQueue.contains(r)) {

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HStore.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HStore.java?rev=731748&r1=731747&r2=731748&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HStore.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HStore.java Mon Jan 
5 14:32:37 2009
@@ -786,7 +786,7 @@
     if (stats == null || stats.length == 0) {
       return 0l;
     }
-    long lowTimestamp = Long.MAX_VALUE;   
+    long lowTimestamp = Long.MAX_VALUE;
     for (int i = 0; i < stats.length; i++) {
       long timestamp = stats[i].getModificationTime();
       if (timestamp < lowTimestamp){
@@ -966,7 +966,12 @@
    * @return True if we should run a major compaction.
    */
   boolean isMajorCompaction() throws IOException {
-    return isMajorCompaction(null);
+    List<HStoreFile> filesToCompact = null;
+    synchronized (storefiles) {
+      // filesToCompact are sorted oldest to newest.
+      filesToCompact = new ArrayList<HStoreFile>(this.storefiles.values());
+    }
+    return isMajorCompaction(filesToCompact);
   }
 
   /*
@@ -977,25 +982,24 @@
   throws IOException {
     boolean result = false;
     Path mapdir = HStoreFile.getMapDir(this.basedir, this.info.getEncodedName(),
-        this.family.getName());
+      this.family.getName());
     long lowTimestamp = getLowestTimestamp(fs, mapdir);
-    if (lowTimestamp < (System.currentTimeMillis() - this.majorCompactionTime) &&
-        lowTimestamp > 0l) {
+    long now = System.currentTimeMillis();
+    if (lowTimestamp > 0l && lowTimestamp < (now - this.majorCompactionTime))
{
       // Major compaction time has elapsed.
-      long elapsedTime = System.currentTimeMillis() - lowTimestamp;
+      long elapsedTime = now - lowTimestamp;
       if (filesToCompact != null && filesToCompact.size() == 1 &&
           filesToCompact.get(0).isMajorCompaction() &&
           (this.ttl == HConstants.FOREVER || elapsedTime < this.ttl)) {
         if (LOG.isDebugEnabled()) {
-          LOG.debug("Skipping major compaction because only one (major) " +
-            "compacted file only and elapsedTime " + elapsedTime +
-            " is < ttl=" + this.ttl);
+          LOG.debug("Skipping major compaction of " + this.storeNameStr +
+            " because one (major) compacted file only and elapsedTime " +
+            elapsedTime + "ms is < ttl=" + this.ttl);
         }
       } else {
         if (LOG.isDebugEnabled()) {
-          LOG.debug("Major compaction triggered on store: " +
-              this.storeNameStr + ". Time since last major compaction: " +
-              ((System.currentTimeMillis() - lowTimestamp)/1000) + " seconds");
+          LOG.debug("Major compaction triggered on store " + this.storeNameStr +
+            "; time since last major compaction " + (now - lowTimestamp) + "ms");
         }
         result = true;
       }

Modified: hadoop/hbase/trunk/src/webapps/master/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/webapps/master/WEB-INF/web.xml?rev=731748&r1=731747&r2=731748&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/webapps/master/WEB-INF/web.xml (original)
+++ hadoop/hbase/trunk/src/webapps/master/WEB-INF/web.xml Mon Jan  5 14:32:37 2009
@@ -10,8 +10,8 @@
 
 
     <servlet>
-        <servlet-name>org.apache.hadoop.hbase.generated.master.master_jsp</servlet-name>
-        <servlet-class>org.apache.hadoop.hbase.generated.master.master_jsp</servlet-class>
+        <servlet-name>org.apache.hadoop.hbase.generated.master.table_jsp</servlet-name>
+        <servlet-class>org.apache.hadoop.hbase.generated.master.table_jsp</servlet-class>
     </servlet>
 
     <servlet>
@@ -20,13 +20,13 @@
     </servlet>
 
     <servlet>
-        <servlet-name>org.apache.hadoop.hbase.generated.master.table_jsp</servlet-name>
-        <servlet-class>org.apache.hadoop.hbase.generated.master.table_jsp</servlet-class>
+        <servlet-name>org.apache.hadoop.hbase.generated.master.master_jsp</servlet-name>
+        <servlet-class>org.apache.hadoop.hbase.generated.master.master_jsp</servlet-class>
     </servlet>
 
     <servlet-mapping>
-        <servlet-name>org.apache.hadoop.hbase.generated.master.master_jsp</servlet-name>
-        <url-pattern>/master.jsp</url-pattern>
+        <servlet-name>org.apache.hadoop.hbase.generated.master.table_jsp</servlet-name>
+        <url-pattern>/table.jsp</url-pattern>
     </servlet-mapping>
 
     <servlet-mapping>
@@ -35,8 +35,8 @@
     </servlet-mapping>
 
     <servlet-mapping>
-        <servlet-name>org.apache.hadoop.hbase.generated.master.table_jsp</servlet-name>
-        <url-pattern>/table.jsp</url-pattern>
+        <servlet-name>org.apache.hadoop.hbase.generated.master.master_jsp</servlet-name>
+        <url-pattern>/master.jsp</url-pattern>
     </servlet-mapping>
 
 </web-app>



Mime
View raw message