Author: stack
Date: Tue Jul 7 03:47:44 2009
New Revision: 791694
URL: http://svn.apache.org/viewvc?rev=791694&view=rev
Log:
HBASE-1616 Unit test of compacting referenced StoreFiles
Modified:
hadoop/hbase/trunk/CHANGES.txt
hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/client/TestForceSplit.java
Modified: hadoop/hbase/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=791694&r1=791693&r2=791694&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Tue Jul 7 03:47:44 2009
@@ -244,6 +244,7 @@
HBASE-1608 TestCachedBlockQueue failing on some jvms (Jon Gray via Stack)
HBASE-1615 HBASE-1597 introduced a bug when compacting after a split
(Jon Gray via Stack)
+ HBASE-1616 Unit test of compacting referenced StoreFiles (Jon Gray via
Stack)
IMPROVEMENTS
HBASE-1089 Add count of regions on filesystem to master UI; add percentage
Modified:
hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/client/TestForceSplit.java
URL:
http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/client/TestForceSplit.java?rev=791694&r1=791693&r2=791694&view=diff
==============================================================================
---
hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/client/TestForceSplit.java
(original)
+++
hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/client/TestForceSplit.java
Tue Jul 7 03:47:44 2009
@@ -48,6 +48,7 @@
* @throws Exception
* @throws IOException
*/
+ @SuppressWarnings("unused")
public void testForceSplit() throws Exception {
// create the test table
HTableDescriptor htd = new HTableDescriptor(tableName);
@@ -56,6 +57,7 @@
admin.createTable(htd);
HTable table = new HTable(conf, tableName);
byte[] k = new byte[3];
+ int rowCount = 0;
for (byte b1 = 'a'; b1 < 'z'; b1++) {
for (byte b2 = 'a'; b2 < 'z'; b2++) {
for (byte b3 = 'a'; b3 < 'z'; b3++) {
@@ -66,6 +68,7 @@
byte [][] famAndQf = KeyValue.parseColumn(columnName);
put.add(famAndQf[0], famAndQf[1], k);
table.put(put);
+ rowCount++;
}
}
}
@@ -75,6 +78,16 @@
System.out.println("Initial regions (" + m.size() + "): " + m);
assertTrue(m.size() == 1);
+ // Verify row count
+ Scan scan = new Scan();
+ ResultScanner scanner = table.getScanner(scan);
+ int rows = 0;
+ for(Result result : scanner) {
+ rows++;
+ }
+ scanner.close();
+ assertEquals(rowCount, rows);
+
// tell the master to split the table
admin.split(Bytes.toString(tableName));
@@ -86,5 +99,20 @@
System.out.println("Regions after split (" + m.size() + "): " + m);
// should have two regions now
assertTrue(m.size() == 2);
+
+ // Verify row count
+ scan = new Scan();
+ scanner = table.getScanner(scan);
+ rows = 0;
+ for(Result result : scanner) {
+ rows++;
+ if(rows > rowCount) {
+ scanner.close();
+ assertTrue("Have already scanned more rows than expected (" +
+ rowCount + ")", false);
+ }
+ }
+ scanner.close();
+ assertEquals(rowCount, rows);
}
}