hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jxi...@apache.org
Subject svn commit: r1576118 - in /hbase/trunk/hbase-server/src: main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRolling.java
Date Mon, 10 Mar 2014 22:48:20 GMT
Author: jxiang
Date: Mon Mar 10 22:48:19 2014
New Revision: 1576118

URL: http://svn.apache.org/r1576118
Log:
HBASE-10714 SyncFuture hangs when sequence is 0

Modified:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRolling.java

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java?rev=1576118&r1=1576117&r2=1576118&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java
Mon Mar 10 22:48:19 2014
@@ -516,6 +516,9 @@ class FSHLog implements HLog, Syncable {
     this.disruptor =
       new Disruptor<RingBufferTruck>(RingBufferTruck.EVENT_FACTORY, preallocatedEventCount,
         this.appendExecutor, ProducerType.MULTI, new BlockingWaitStrategy());
+    // Advance the ring buffer sequence so that it starts from 1 instead of 0,
+    // because SyncFuture.NOT_DONE = 0.
+    this.disruptor.getRingBuffer().next();
     this.ringBufferEventHandler =
       new RingBufferEventHandler(conf.getInt("hbase.regionserver.hlog.syncer.count", 5),
         maxHandlersCount);

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRolling.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRolling.java?rev=1576118&r1=1576117&r2=1576118&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRolling.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRolling.java
Mon Mar 10 22:48:19 2014
@@ -35,7 +35,7 @@ import java.util.Set;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.commons.logging.impl.Log4JLogger;
+import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
@@ -62,12 +62,9 @@ import org.apache.hadoop.hbase.util.Byte
 import org.apache.hadoop.hbase.util.FSUtils;
 import org.apache.hadoop.hbase.util.JVMClusterUtil;
 import org.apache.hadoop.hbase.util.Threads;
-import org.apache.hadoop.hdfs.DFSClient;
 import org.apache.hadoop.hdfs.MiniDFSCluster;
 import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
 import org.apache.hadoop.hdfs.server.datanode.DataNode;
-import org.apache.hadoop.hdfs.server.namenode.LeaseManager;
-import org.apache.log4j.Level;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
@@ -197,6 +194,23 @@ public class TestLogRolling  {
   }
 
   /**
+   * Tests that log rolling doesn't hang when no data is written.
+   */
+  @Test(timeout=120000)
+  public void testLogRollOnNothingWritten() throws Exception {
+    Configuration conf = TEST_UTIL.getConfiguration();
+    HFileSystem fs = new HFileSystem(conf, false);
+    HLog newLog = HLogFactory.createHLog(fs.getBackingFs(),
+      FSUtils.getRootDir(conf), "test", conf, null, "test.com:8080:1");
+    try {
+      // Now roll the log before we write anything.
+      newLog.rollWriter(true);
+    } finally {
+      newLog.closeAndDelete();
+    }
+  }
+
+  /**
    * Tests that logs are deleted
    * @throws IOException
    * @throws org.apache.hadoop.hbase.regionserver.wal.FailedLogCloseException



Mime
View raw message