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 2009/05/13 22:53:08 UTC

svn commit: r774524 - in /hadoop/hbase/branches/0.19: CHANGES.txt conf/hbase-default.xml src/java/org/apache/hadoop/hbase/regionserver/HLog.java

Author: stack
Date: Wed May 13 20:53:08 2009
New Revision: 774524

URL: http://svn.apache.org/viewvc?rev=774524&view=rev
Log:
HBASE-1413 fall back to filesystem block size default if hbase.regionserver.hlog.blocksize is not specified

Modified:
    hadoop/hbase/branches/0.19/CHANGES.txt
    hadoop/hbase/branches/0.19/conf/hbase-default.xml
    hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/regionserver/HLog.java

Modified: hadoop/hbase/branches/0.19/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.19/CHANGES.txt?rev=774524&r1=774523&r2=774524&view=diff
==============================================================================
--- hadoop/hbase/branches/0.19/CHANGES.txt (original)
+++ hadoop/hbase/branches/0.19/CHANGES.txt Wed May 13 20:53:08 2009
@@ -1,7 +1,11 @@
 HBase Change Log
-
 Release 0.19.2 - Unreleased
   BUG FIXES
+   HBASE-1413  fall back to filesystem block size default if
+               hbase.regionserver.hlog.blocksize is not specified
+
+Release 0.19.2 - May 9th, 2009 
+  BUG FIXES
    HBASE-1303  Secondary index configuration prevents HBase from starting
                (Ken Weiner via Stack)
    HBASE-1202  getRow does not always work when specifying number of versions

Modified: hadoop/hbase/branches/0.19/conf/hbase-default.xml
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.19/conf/hbase-default.xml?rev=774524&r1=774523&r2=774524&view=diff
==============================================================================
--- hadoop/hbase/branches/0.19/conf/hbase-default.xml (original)
+++ hadoop/hbase/branches/0.19/conf/hbase-default.xml Wed May 13 20:53:08 2009
@@ -181,14 +181,6 @@
     </description>
   </property>
   <property>
-    <name>hbase.regionserver.hlog.blocksize</name>
-    <value>1048576</value>
-    <description>Block size for HLog files. To minimize potential data loss,
-    the size should be (avg key length) * (avg value length) * flushlogentries.
-    Default 1MB.
-    </description>
-  </property>
-  <property>
     <name>hbase.regionserver.thread.splitcompactcheckfrequency</name>
     <value>20000</value>
     <description>How often a region server runs the split/compaction check.

Modified: hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/regionserver/HLog.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/regionserver/HLog.java?rev=774524&r1=774523&r2=774524&view=diff
==============================================================================
--- hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/regionserver/HLog.java (original)
+++ hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/regionserver/HLog.java Wed May 13 20:53:08 2009
@@ -172,8 +172,8 @@
       conf.getInt("hbase.regionserver.maxlogentries", 100000);
     this.flushlogentries =
       conf.getInt("hbase.regionserver.flushlogentries", 100);
-    this.blocksize =
-      conf.getLong("hbase.regionserver.hlog.blocksize", 1024L * 1024L);
+    this.blocksize = conf.getLong("hbase.regionserver.hlog.blocksize",
+      this.fs.getDefaultBlockSize());
     this.optionalFlushInterval =
       conf.getLong("hbase.regionserver.optionallogflushinterval", 10 * 1000);
     this.threadWakeFrequency = conf.getLong(THREAD_WAKE_FREQUENCY, 10 * 1000);
@@ -183,6 +183,10 @@
     }
     fs.mkdirs(dir);
     this.maxLogs = conf.getInt("hbase.regionserver.maxlogs", 64);
+    LOG.info("HLog configuration: blocksize=" + this.blocksize +
+      ", maxlogentries=" + this.maxlogentries + ", flushlogentries=" +
+      this.flushlogentries + ", optionallogflushinternal=" +
+      this.optionalFlushInterval + "ms");
     rollWriter();
   }
 
@@ -273,7 +277,7 @@
           new Metadata());
 
         LOG.info((oldFile != null?
-          "Closed " + oldFile + ", entries=" + this.numEntries + ". ": "") +
+          "Closed " + oldFile + ", entries=" + this.numEntries.get() + ". ": "") +
           "New log writer: " + FSUtils.getPath(newPath));
 
         // Can we delete any of the old log files?
@@ -500,6 +504,7 @@
 
   void optionalSync() {
     if (!this.closed) {
+      long now = System.currentTimeMillis();
       synchronized (updateLock) {
         if (((System.currentTimeMillis() - this.optionalFlushInterval) >
         this.lastLogFlushTime) && this.unflushedEntries > 0) {
@@ -510,6 +515,11 @@
           }
         }
       }
+      long took = System.currentTimeMillis() - now;
+      if (took > 1000) {
+        LOG.warn(Thread.currentThread().getName() + " took " + took +
+          "ms optional sync to HLog; editcount=" + this.numEntries.get());
+      }
     }
   }
   
@@ -522,10 +532,16 @@
   private void doWrite(HLogKey logKey, HLogEdit logEdit, boolean sync)
   throws IOException {
     try {
+      long now = System.currentTimeMillis();
       this.writer.append(logKey, logEdit);
       if (sync || ++unflushedEntries >= flushlogentries) {
         sync();
       }
+      long took = System.currentTimeMillis() - now;
+      if (took > 1000) {
+        LOG.warn(Thread.currentThread().getName() + " took " + took +
+          "ms appending an edit to HLog; editcount=" + this.numEntries.get());
+      }
     } catch (IOException e) {
       LOG.fatal("Could not append. Requesting close of log", e);
       requestLogRoll();
@@ -741,7 +757,7 @@
       for (int i = 0; i < logfiles.length; i++) {
         if (LOG.isDebugEnabled()) {
           LOG.debug("Splitting " + (i + 1) + " of " + logfiles.length + ": " +
-            logfiles[i].getPath());
+            logfiles[i].getPath() + ", length=" + logfiles[i].getLen());
         }
         // Check for possibly empty file. With appends, currently Hadoop reports
         // a zero length even if the file has been sync'd. Revisit if