You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by jg...@apache.org on 2010/07/15 23:32:53 UTC

svn commit: r964612 - in /hbase/trunk/src/test/java/org/apache/hadoop/hbase: HBaseTestingUtility.java MiniHBaseCluster.java client/TestMultipleTimestamps.java

Author: jgray
Date: Thu Jul 15 21:32:53 2010
New Revision: 964612

URL: http://svn.apache.org/viewvc?rev=964612&view=rev
Log:
HBASE-2517  Quick fix to make tests pass (jgray via pranav)

Modified:
    hbase/trunk/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
    hbase/trunk/src/test/java/org/apache/hadoop/hbase/MiniHBaseCluster.java
    hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestMultipleTimestamps.java

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java?rev=964612&r1=964611&r2=964612&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java Thu Jul 15 21:32:53 2010
@@ -344,6 +344,14 @@ public class HBaseTestingUtility {
     this.hbaseCluster.flushcache();
   }
 
+  /**
+   * Flushes all caches in the mini hbase cluster
+   * @throws IOException
+   */
+  public void flush(byte [] tableName) throws IOException {
+    this.hbaseCluster.flushcache(tableName);
+  }
+
 
   /**
    * Create a table.

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/MiniHBaseCluster.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/MiniHBaseCluster.java?rev=964612&r1=964611&r2=964612&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/MiniHBaseCluster.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/MiniHBaseCluster.java Thu Jul 15 21:32:53 2010
@@ -349,6 +349,21 @@ public class MiniHBaseCluster {
   }
 
   /**
+   * Call flushCache on all regions of the specified table.
+   * @throws IOException
+   */
+  public void flushcache(byte [] tableName) throws IOException {
+    for (JVMClusterUtil.RegionServerThread t:
+        this.hbaseCluster.getRegionServers()) {
+      for(HRegion r: t.getRegionServer().getOnlineRegions()) {
+        if(Bytes.equals(r.getTableDesc().getName(), tableName)) {
+          r.flushcache();
+        }
+      }
+    }
+  }
+
+  /**
    * @return List of region server threads.
    */
   public List<JVMClusterUtil.RegionServerThread> getRegionServerThreads() {

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestMultipleTimestamps.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestMultipleTimestamps.java?rev=964612&r1=964611&r2=964612&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestMultipleTimestamps.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestMultipleTimestamps.java Thu Jul 15 21:32:53 2010
@@ -99,7 +99,7 @@ public class TestMultipleTimestamps {
 
     put(ht, FAMILY, putRows, putColumns, putTimestamps);
 
-    flush();
+    flush(TABLE);
 
     ResultScanner scanner = scan(ht, FAMILY, scanRows, scanColumns,
         scanTimestamps, scanMaxVersions);
@@ -118,8 +118,8 @@ public class TestMultipleTimestamps {
 
   @Test
   public void testReseeksWithMultipleColumnOneTimestamp() throws IOException {
-    byte [] TABLE = Bytes.toBytes("testReseeksWithOne" +
-    "ColumnMiltipleTimestamps");
+    byte [] TABLE = Bytes.toBytes("testReseeksWithMultiple" +
+    "ColumnOneTimestamps");
     byte [] FAMILY = Bytes.toBytes("event_log");
     byte [][] FAMILIES = new byte[][] { FAMILY };
 
@@ -137,7 +137,7 @@ public class TestMultipleTimestamps {
 
     put(ht, FAMILY, putRows, putColumns, putTimestamps);
 
-    flush();
+    flush(TABLE);
 
     ResultScanner scanner = scan(ht, FAMILY, scanRows, scanColumns,
         scanTimestamps, scanMaxVersions);
@@ -155,7 +155,7 @@ public class TestMultipleTimestamps {
   @Test
   public void testReseeksWithMultipleColumnMultipleTimestamp() throws
   IOException {
-    byte [] TABLE = Bytes.toBytes("testReseeksWithOne" +
+    byte [] TABLE = Bytes.toBytes("testReseeksWithMultiple" +
     "ColumnMiltipleTimestamps");
     byte [] FAMILY = Bytes.toBytes("event_log");
     byte [][] FAMILIES = new byte[][] { FAMILY };
@@ -174,7 +174,7 @@ public class TestMultipleTimestamps {
 
     put(ht, FAMILY, putRows, putColumns, putTimestamps);
 
-    flush();
+    flush(TABLE);
 
     ResultScanner scanner = scan(ht, FAMILY, scanRows, scanColumns,
         scanTimestamps, scanMaxVersions);
@@ -197,8 +197,7 @@ public class TestMultipleTimestamps {
 
   @Test
   public void testReseeksWithMultipleFiles() throws IOException {
-    byte [] TABLE = Bytes.toBytes("testReseeksWithOne" +
-    "ColumnMiltipleTimestamps");
+    byte [] TABLE = Bytes.toBytes("testReseeksWithMultipleFiles");
     byte [] FAMILY = Bytes.toBytes("event_log");
     byte [][] FAMILIES = new byte[][] { FAMILY };
 
@@ -224,9 +223,9 @@ public class TestMultipleTimestamps {
     int scanMaxVersions = 5;
 
     put(ht, FAMILY, putRows1, putColumns1, putTimestamps1);
-    flush();
+    flush(TABLE);
     put(ht, FAMILY, putRows2, putColumns2, putTimestamps2);
-    flush();
+    flush(TABLE);
     put(ht, FAMILY, putRows3, putColumns3, putTimestamps3);
 
     ResultScanner scanner = scan(ht, FAMILY, scanRows, scanColumns,
@@ -275,7 +274,7 @@ public class TestMultipleTimestamps {
     putNVersions(ht, FAMILY, 0, 0, 1, 5);
 
     if (flushTables) {
-      flush();
+      flush(TABLE);
     }
 
     // delete version 4.
@@ -303,7 +302,7 @@ public class TestMultipleTimestamps {
     // For row:0, col:0: insert versions 1 through 5.
     putNVersions(ht, FAMILY, 0, 0, 1, 5);
 
-    flush();
+    flush(TABLE);
 
     // delete all versions before 4.
     deleteAllVersionsBefore(ht, FAMILY, 0, 0, 4);
@@ -326,7 +325,7 @@ public class TestMultipleTimestamps {
     // For row:0, col:0: insert versions 1 through 5.
     putNVersions(ht, FAMILY, 0, 0, 1, 5);
 
-    flush();
+    flush(TABLE);
 
     // delete all versions before 4.
     deleteColumn(ht, FAMILY, 0, 0);
@@ -349,7 +348,7 @@ public class TestMultipleTimestamps {
     // For row:0, col:0: insert versions 1 through 5.
     putNVersions(ht, FAMILY, 0, 0, 1, 5);
 
-    flush();
+    flush(TABLE);
 
     // delete all versions before 4.
     deleteFamily(ht, FAMILY, 0);
@@ -361,8 +360,8 @@ public class TestMultipleTimestamps {
   }
 
   // Flush tables. Since flushing is asynchronous, sleep for a bit.
-  private void flush() throws IOException {
-    TEST_UTIL.flush();
+  private void flush(byte [] tableName) throws IOException {
+    TEST_UTIL.flush(tableName);
     try {
       Thread.sleep(3000);
     } catch (InterruptedException i) {