hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jxi...@apache.org
Subject svn commit: r1535256 - in /hbase/branches/0.96/hbase-server/src: main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java
Date Thu, 24 Oct 2013 01:15:10 GMT
Author: jxiang
Date: Thu Oct 24 01:15:09 2013
New Revision: 1535256

URL: http://svn.apache.org/r1535256
Log:
HBASE-9827 Intermittent TestLogRollingNoCluster#testContendedLogRolling failure

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

Modified: hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java?rev=1535256&r1=1535255&r2=1535256&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java
(original)
+++ hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java
Thu Oct 24 01:15:09 2013
@@ -27,7 +27,6 @@ import java.net.URLEncoder;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
-import java.util.LinkedHashSet;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
@@ -50,13 +49,12 @@ import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.Syncable;
-import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.HBaseConfiguration;
 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.regionserver.RegionCoprocessorHost;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.ClassSize;
 import org.apache.hadoop.hbase.util.DrainBarrier;
@@ -499,6 +497,10 @@ class FSHLog implements HLog, Syncable {
         }
         this.filenum = System.currentTimeMillis();
         Path newPath = computeFilename();
+        while (fs.exists(newPath)) {
+          this.filenum++;
+          newPath = computeFilename();
+        }
 
         // Tell our listeners that a new log is about to be created
         if (!this.listeners.isEmpty()) {

Modified: hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java?rev=1535256&r1=1535255&r2=1535256&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java
(original)
+++ hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java
Thu Oct 24 01:15:09 2013
@@ -711,6 +711,24 @@ public class TestHLog  {
     }
   }
 
+  @Test
+  public void testFailedToCreateHLogIfParentRenamed() throws IOException {
+    FSHLog log = (FSHLog)HLogFactory.createHLog(
+      fs, hbaseDir, "testFailedToCreateHLogIfParentRenamed", conf);
+    long filenum = System.currentTimeMillis();
+    Path path = log.computeFilename(filenum);
+    HLogFactory.createWALWriter(fs, path, conf);
+    Path parent = path.getParent();
+    path = log.computeFilename(filenum + 1);
+    Path newPath = new Path(parent.getParent(), parent.getName() + "-splitting");
+    fs.rename(parent, newPath);
+    try {
+      HLogFactory.createWALWriter(fs, path, conf);
+      fail("It should fail to create the new WAL");
+    } catch (IOException ioe) {
+      // expected, good.
+    }
+  }
 
   @Test
   public void testGetServerNameFromHLogDirectoryName() throws IOException {



Mime
View raw message