Index: src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java =================================================================== --- src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java (revision 964522) +++ src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java (working copy) @@ -344,7 +344,15 @@ 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. * @param tableName Index: src/test/java/org/apache/hadoop/hbase/MiniHBaseCluster.java =================================================================== --- src/test/java/org/apache/hadoop/hbase/MiniHBaseCluster.java (revision 964522) +++ src/test/java/org/apache/hadoop/hbase/MiniHBaseCluster.java (working copy) @@ -349,6 +349,21 @@ } /** + * 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 getRegionServerThreads() { Index: src/test/java/org/apache/hadoop/hbase/client/TestMultipleTimestamps.java =================================================================== --- src/test/java/org/apache/hadoop/hbase/client/TestMultipleTimestamps.java (revision 964522) +++ src/test/java/org/apache/hadoop/hbase/client/TestMultipleTimestamps.java (working copy) @@ -99,7 +99,7 @@ put(ht, FAMILY, putRows, putColumns, putTimestamps); - flush(); + flush(TABLE); ResultScanner scanner = scan(ht, FAMILY, scanRows, scanColumns, scanTimestamps, scanMaxVersions); @@ -118,8 +118,8 @@ @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 @@ put(ht, FAMILY, putRows, putColumns, putTimestamps); - flush(); + flush(TABLE); ResultScanner scanner = scan(ht, FAMILY, scanRows, scanColumns, scanTimestamps, scanMaxVersions); @@ -155,7 +155,7 @@ @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 @@ put(ht, FAMILY, putRows, putColumns, putTimestamps); - flush(); + flush(TABLE); ResultScanner scanner = scan(ht, FAMILY, scanRows, scanColumns, scanTimestamps, scanMaxVersions); @@ -197,8 +197,7 @@ @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 @@ 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 @@ putNVersions(ht, FAMILY, 0, 0, 1, 5); if (flushTables) { - flush(); + flush(TABLE); } // delete version 4. @@ -303,7 +302,7 @@ // 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 @@ // 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 @@ // 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 @@ } // 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) {