HBASE-1616 Unit test of compacting referenced StoreFiles

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@791694 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2009-07-07 03:47:44 +00:00
parent 619a7243d0
commit 085f87eebb
2 changed files with 29 additions and 0 deletions

View File

@ -244,6 +244,7 @@ Release 0.20.0 - Unreleased
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

View File

@ -48,6 +48,7 @@ public class TestForceSplit extends HBaseClusterTestCase {
* @throws Exception
* @throws IOException
*/
@SuppressWarnings("unused")
public void testForceSplit() throws Exception {
// create the test table
HTableDescriptor htd = new HTableDescriptor(tableName);
@ -56,6 +57,7 @@ public class TestForceSplit extends HBaseClusterTestCase {
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 @@ public class TestForceSplit extends HBaseClusterTestCase {
byte [][] famAndQf = KeyValue.parseColumn(columnName);
put.add(famAndQf[0], famAndQf[1], k);
table.put(put);
rowCount++;
}
}
}
@ -75,6 +78,16 @@ public class TestForceSplit extends HBaseClusterTestCase {
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 @@ public class TestForceSplit extends HBaseClusterTestCase {
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);
}
}