hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject svn commit: r1483006 - in /hbase/branches/0.95/hbase-server/src: main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRolling.java
Date Wed, 15 May 2013 18:53:05 GMT
Author: enis
Date: Wed May 15 18:53:05 2013
New Revision: 1483006

URL: http://svn.apache.org/r1483006
Log:
HBASE-5995 Fix and reenable TestLogRolling.testLogRollOnPipelineRestart

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

Modified: hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java?rev=1483006&r1=1483005&r2=1483006&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java
(original)
+++ hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java
Wed May 15 18:53:05 2013
@@ -475,11 +475,14 @@ class FSHLog implements HLog, Syncable {
         return null;
       }
       byte [][] regionsToFlush = null;
+      if (closed) {
+        LOG.debug("HLog closed. Skipping rolling of writer");
+        return null;
+      }
       try {
         this.logRollRunning = true;
-        boolean isClosed = closed;
-        if (isClosed || !closeBarrier.beginOp()) {
-          LOG.debug("HLog " + (isClosed ? "closed" : "closing") + ". Skipping rolling of
writer");
+        if (!closeBarrier.beginOp()) {
+          LOG.debug("HLog closing. Skipping rolling of writer");
           return regionsToFlush;
         }
         // Do all the preparation outside of the updateLock to block
@@ -955,6 +958,7 @@ class FSHLog implements HLog, Syncable {
           } catch (IOException e) {
             LOG.error("Error while syncing, requesting close of hlog ", e);
             requestLogRoll();
+            Threads.sleep(this.optionalFlushInterval);
           }
         }
       } catch (InterruptedException e) {
@@ -1081,7 +1085,7 @@ class FSHLog implements HLog, Syncable {
         }
       }
     } catch (IOException e) {
-      LOG.fatal("Could not sync. Requesting close of hlog", e);
+      LOG.fatal("Could not sync. Requesting roll of hlog", e);
       requestLogRoll();
       throw e;
     }
@@ -1160,18 +1164,22 @@ class FSHLog implements HLog, Syncable {
     return this.getNumCurrentReplicas != null;
   }
 
+  @Override
   public void hsync() throws IOException {
     syncer();
   }
 
+  @Override
   public void hflush() throws IOException {
     syncer();
   }
 
+  @Override
   public void sync() throws IOException {
     syncer();
   }
 
+  @Override
   public void sync(long txid) throws IOException {
     syncer(txid);
   }

Modified: hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRolling.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRolling.java?rev=1483006&r1=1483005&r2=1483006&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRolling.java
(original)
+++ hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRolling.java
Wed May 15 18:53:05 2013
@@ -18,33 +18,60 @@
  */
 package org.apache.hadoop.hbase.regionserver.wal;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.EOFException;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+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.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.hbase.*;
-import org.apache.hadoop.hbase.client.*;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.HColumnDescriptor;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.HRegionInfo;
+import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.LargeTests;
+import org.apache.hadoop.hbase.MiniHBaseCluster;
+import org.apache.hadoop.hbase.client.Get;
+import org.apache.hadoop.hbase.client.HBaseAdmin;
+import org.apache.hadoop.hbase.client.HTable;
+import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.client.Result;
+import org.apache.hadoop.hbase.client.ResultScanner;
+import org.apache.hadoop.hbase.client.Scan;
 import org.apache.hadoop.hbase.exceptions.FailedLogCloseException;
+import org.apache.hadoop.hbase.fs.HFileSystem;
 import org.apache.hadoop.hbase.regionserver.HRegion;
 import org.apache.hadoop.hbase.regionserver.HRegionServer;
-import org.apache.hadoop.hbase.util.*;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.FSUtils;
+import org.apache.hadoop.hbase.util.JVMClusterUtil;
 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.*;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import java.io.*;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.*;
-
-import static org.junit.Assert.*;
-
 /**
  * Test log deletion as logs are rolled.
  */
@@ -403,7 +430,7 @@ public class TestLogRolling  {
    * restarted.
    * @throws Exception
    */
-  //DISABLED BECAUSE FLAKEY @Test
+  @Test
   public void testLogRollOnPipelineRestart() throws Exception {
     LOG.info("Starting testLogRollOnPipelineRestart");
     assertTrue("This test requires HLog file replication.",
@@ -504,11 +531,15 @@ public class TestLogRolling  {
 
     // read back the data written
     Set<String> loggedRows = new HashSet<String>();
+    FSUtils fsUtils = FSUtils.getInstance(fs, TEST_UTIL.getConfiguration());
     for (Path p : paths) {
+      LOG.debug("recovering lease for " + p);
+      fsUtils.recoverFileLease(((HFileSystem)fs).getBackingFs(), p, TEST_UTIL.getConfiguration(),
null);
+
       LOG.debug("Reading HLog "+FSUtils.getPath(p));
       HLog.Reader reader = null;
       try {
-        reader = HLogFactory.createReader(fs, p, 
+        reader = HLogFactory.createReader(fs, p,
             TEST_UTIL.getConfiguration());
         HLog.Entry entry;
         while ((entry = reader.next()) != null) {



Mime
View raw message