hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject svn commit: r1521280 - in /hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot: SnapshotTestingUtils.java TestFlushSnapshotFromClient.java
Date Mon, 09 Sep 2013 20:25:15 GMT
Author: tedyu
Date: Mon Sep  9 20:25:15 2013
New Revision: 1521280

URL: http://svn.apache.org/r1521280
Log:
HBASE-9458 Intermittent TestFlushSnapshotFromClient#testTakeSnapshotAfterMerge failure


Modified:
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestFlushSnapshotFromClient.java

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java?rev=1521280&r1=1521279&r2=1521280&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java
Mon Sep  9 20:25:15 2013
@@ -246,6 +246,27 @@ public class SnapshotTestingUtils {
     }
   }
 
+  /*
+   * Take snapshot with maximum of numTries attempts, ignoring CorruptedSnapshotException
+   * except for the last CorruptedSnapshotException
+   */
+  public static void snapshot(HBaseAdmin admin,
+      final String snapshotName, final String tableName,
+      SnapshotDescription.Type type, int numTries) throws IOException {
+    int tries = 0;
+    CorruptedSnapshotException lastEx = null;
+    while (tries++ < numTries) {
+      try {
+        admin.snapshot(snapshotName, tableName, type);
+        return;
+      } catch (CorruptedSnapshotException cse) {
+        LOG.warn("Got CorruptedSnapshotException", cse);
+        lastEx = cse;
+      }
+    }
+    throw lastEx;
+  }
+
   public static void cleanupSnapshot(HBaseAdmin admin, byte[] tableName)
       throws IOException {
     SnapshotTestingUtils.cleanupSnapshot(admin, Bytes.toString(tableName));

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestFlushSnapshotFromClient.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestFlushSnapshotFromClient.java?rev=1521280&r1=1521279&r2=1521280&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestFlushSnapshotFromClient.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestFlushSnapshotFromClient.java
Mon Sep  9 20:25:15 2013
@@ -35,24 +35,24 @@ import org.apache.commons.logging.impl.L
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.LargeTests;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.TableNotFoundException;
-import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
-import org.apache.hadoop.hbase.ipc.RpcClient;
-import org.apache.hadoop.hbase.ipc.RpcServer;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.ScannerCallable;
+import org.apache.hadoop.hbase.ipc.RpcClient;
+import org.apache.hadoop.hbase.ipc.RpcServer;
 import org.apache.hadoop.hbase.master.HMaster;
 import org.apache.hadoop.hbase.master.snapshot.SnapshotManager;
 import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription;
 import org.apache.hadoop.hbase.regionserver.ConstantSizeRegionSplitPolicy;
 import org.apache.hadoop.hbase.regionserver.HRegionFileSystem;
+import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.FSTableDescriptors;
 import org.apache.hadoop.hbase.util.FSUtils;
@@ -315,7 +315,8 @@ public class TestFlushSnapshotFromClient
 
     // Take a snapshot
     String snapshotName = "snapshotAfterMerge";
-    admin.snapshot(snapshotName, STRING_TABLE_NAME, SnapshotDescription.Type.FLUSH);
+    SnapshotTestingUtils.snapshot(admin, snapshotName, STRING_TABLE_NAME,
+      SnapshotDescription.Type.FLUSH, 3);
 
     // Clone the table
     String cloneName = "cloneMerge";



Mime
View raw message