You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by la...@apache.org on 2012/12/22 08:11:47 UTC

svn commit: r1425251 - in /hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase: HBaseTestingUtility.java replication/TestReplication.java

Author: larsh
Date: Sat Dec 22 07:11:47 2012
New Revision: 1425251

URL: http://svn.apache.org/viewvc?rev=1425251&view=rev
Log:
HBASE-7417 Test patch, hopefully fixes TestReplication

Modified:
    hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
    hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/replication/TestReplication.java

Modified: hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java?rev=1425251&r1=1425250&r2=1425251&view=diff
==============================================================================
--- hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java (original)
+++ hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java Sat Dec 22 07:11:47 2012
@@ -39,7 +39,6 @@ import java.util.Map;
 import java.util.NavigableSet;
 import java.util.Random;
 import java.util.UUID;
-import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -1110,7 +1109,7 @@ public class HBaseTestingUtility {
    */
   public int createMultiRegions(HTable table, byte[] columnFamily)
   throws IOException {
-    return createMultiRegions(getConfiguration(), table, columnFamily);
+    return createMultiRegions(table, columnFamily, true);
   }
 
   public static final byte[][] KEYS = {
@@ -1127,16 +1126,16 @@ public class HBaseTestingUtility {
 
   /**
    * Creates many regions names "aaa" to "zzz".
-   * @param c Configuration to use.
+   *
    * @param table  The table to use for the data.
    * @param columnFamily  The family to insert the data into.
+   * @param cleanupFS  True if a previous region should be remove from the FS  
    * @return count of regions created.
    * @throws IOException When creating the regions fails.
    */
-  public int createMultiRegions(final Configuration c, final HTable table,
-      final byte[] columnFamily)
+  public int createMultiRegions(HTable table, byte[] columnFamily, boolean cleanupFS)
   throws IOException {
-    return createMultiRegions(c, table, columnFamily, KEYS);
+    return createMultiRegions(getConfiguration(), table, columnFamily, KEYS, cleanupFS);
   }
 
   /**
@@ -1164,7 +1163,12 @@ public class HBaseTestingUtility {
   }
 
   public int createMultiRegions(final Configuration c, final HTable table,
-      final byte[] columnFamily, byte [][] startKeys)
+      final byte[] columnFamily, byte [][] startKeys) throws IOException {
+    return createMultiRegions(c, table, columnFamily, startKeys, true);
+  }
+  
+  public int createMultiRegions(final Configuration c, final HTable table,
+          final byte[] columnFamily, byte [][] startKeys, boolean cleanupFS)
   throws IOException {
     Arrays.sort(startKeys, Bytes.BYTES_COMPARATOR);
     HTable meta = new HTable(c, HConstants.META_TABLE_NAME);
@@ -1202,11 +1206,14 @@ public class HBaseTestingUtility {
         Bytes.toStringBinary(row));
       meta.delete(new Delete(row));
     }
-    // remove the "old" region from FS
-    Path tableDir = new Path(getDefaultRootDirPath().toString()
-        + System.getProperty("file.separator") + htd.getNameAsString()
-        + System.getProperty("file.separator") + regionToDeleteInFS);
-    getDFSCluster().getFileSystem().delete(tableDir);
+    if (cleanupFS) {
+      // see HBASE-7417 - this confused TestReplication
+      // remove the "old" region from FS
+      Path tableDir = new Path(getDefaultRootDirPath().toString()
+          + System.getProperty("file.separator") + htd.getNameAsString()
+          + System.getProperty("file.separator") + regionToDeleteInFS);
+      getDFSCluster().getFileSystem().delete(tableDir);
+    }
     // flush cache of regions
     HConnection conn = table.getConnection();
     conn.clearRegionCache();

Modified: hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/replication/TestReplication.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/replication/TestReplication.java?rev=1425251&r1=1425250&r2=1425251&view=diff
==============================================================================
--- hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/replication/TestReplication.java (original)
+++ hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/replication/TestReplication.java Sat Dec 22 07:11:47 2012
@@ -79,7 +79,7 @@ public class TestReplication {
   private static final int NB_ROWS_IN_BIG_BATCH =
       NB_ROWS_IN_BATCH * 10;
   private static final long SLEEP_TIME = 1500;
-  private static final int NB_RETRIES = 10;
+  private static final int NB_RETRIES = 15;
 
   private static final byte[] tableName = Bytes.toBytes("test");
   private static final byte[] famName = Bytes.toBytes("f");
@@ -716,7 +716,7 @@ public class TestReplication {
    */
   @Test(timeout=300000)
   public void queueFailover() throws Exception {
-    utility1.createMultiRegions(htable1, famName);
+    utility1.createMultiRegions(htable1, famName, false);
 
     // killing the RS with .META. can result into failed puts until we solve
     // IO fencing