@Test public void test() throws Exception { // sleep every 10 loops to give memstore compaction enough time to finish before reaching the // flush size. doIncrement(10); assertSum(); HStore store = UTIL.getHBaseCluster().findRegionsForTable(NAME).get(0).getStore(FAMILY); // should have no store files created as we have done aggregating all in memory assertEquals(0, store.getStorefilesCount()); } }
/** * Test that a regionserver is able to abort properly, even when a coprocessor * throws an exception in preStopRegionServer(). */ @Test public void testAbortFromRPC() throws Exception { TableName tableName = TableName.valueOf("testAbortFromRPC"); // create a test table Table table = testUtil.createTable(tableName, FAMILY_BYTES); // write some edits testUtil.loadTable(table, FAMILY_BYTES); LOG.info("Wrote data"); // force a flush cluster.flushcache(tableName); LOG.info("Flushed table"); // Send a poisoned put to trigger the abort Put put = new Put(new byte[]{0, 0, 0, 0}); put.addColumn(FAMILY_BYTES, Bytes.toBytes("c"), new byte[]{}); put.setAttribute(StopBlockingRegionObserver.DO_ABORT, new byte[]{1}); List<HRegion> regions = cluster.findRegionsForTable(tableName); HRegion firstRegion = cluster.findRegionsForTable(tableName).get(0); table.put(put); // Verify that the regionserver is stopped assertNotNull(firstRegion); assertNotNull(firstRegion.getRegionServerServices()); LOG.info("isAborted = " + firstRegion.getRegionServerServices().isAborted()); assertTrue(firstRegion.getRegionServerServices().isAborted()); LOG.info("isStopped = " + firstRegion.getRegionServerServices().isStopped()); assertTrue(firstRegion.getRegionServerServices().isStopped()); }
LOG.info("Loading test table"); List<HRegion> testRegions = TEST_UTIL.getMiniHBaseCluster().findRegionsForTable(TABLE_NAME); assertEquals(1, testRegions.size()); compactingRegion = (CompactionBlockerRegion)testRegions.get(0);
@Test public void test() throws Exception { doIncrement(0); assertSum(); // we do not hack scan operation so using scan we could get the original values added into the // table. try (ResultScanner scanner = TABLE.getScanner(new Scan().withStartRow(ROW) .withStopRow(ROW, true).addFamily(FAMILY).readAllVersions().setAllowPartialResults(true))) { Result r = scanner.next(); assertTrue(r.rawCells().length > 2); } UTIL.flush(NAME); HRegion region = UTIL.getHBaseCluster().findRegionsForTable(NAME).get(0); HStore store = region.getStore(FAMILY); for (;;) { region.compact(true); if (store.getStorefilesCount() == 1) { break; } } assertSum(); // Should only have two cells after flush and major compaction try (ResultScanner scanner = TABLE.getScanner(new Scan().withStartRow(ROW) .withStopRow(ROW, true).addFamily(FAMILY).readAllVersions().setAllowPartialResults(true))) { Result r = scanner.next(); assertEquals(2, r.rawCells().length); } } }
@Test public void test() throws Exception { // sleep every 10 loops to give memstore compaction enough time to finish before reaching the // flush size. doIncrement(10); assertSum(); HStore store = UTIL.getHBaseCluster().findRegionsForTable(NAME).get(0).getStore(FAMILY); // should have no store files created as we have done aggregating all in memory assertEquals(0, store.getStorefilesCount()); } }
@Test public void test() throws Exception { // sleep every 10 loops to give memstore compaction enough time to finish before reaching the // flush size. doIncrement(10); assertSum(); HStore store = UTIL.getHBaseCluster().findRegionsForTable(NAME).get(0).getStore(FAMILY); // should have no store files created as we have done aggregating all in memory assertEquals(0, store.getStorefilesCount()); } }
/** * Test that a regionserver is able to abort properly, even when a coprocessor * throws an exception in preStopRegionServer(). */ @Test public void testAbortFromRPC() throws Exception { TableName tableName = TableName.valueOf("testAbortFromRPC"); // create a test table Table table = testUtil.createTable(tableName, FAMILY_BYTES); // write some edits testUtil.loadTable(table, FAMILY_BYTES); LOG.info("Wrote data"); // force a flush cluster.flushcache(tableName); LOG.info("Flushed table"); // Send a poisoned put to trigger the abort Put put = new Put(new byte[]{0, 0, 0, 0}); put.addColumn(FAMILY_BYTES, Bytes.toBytes("c"), new byte[]{}); put.setAttribute(StopBlockingRegionObserver.DO_ABORT, new byte[]{1}); List<HRegion> regions = cluster.findRegionsForTable(tableName); HRegion firstRegion = cluster.findRegionsForTable(tableName).get(0); table.put(put); // Verify that the regionserver is stopped assertNotNull(firstRegion); assertNotNull(firstRegion.getRegionServerServices()); LOG.info("isAborted = " + firstRegion.getRegionServerServices().isAborted()); assertTrue(firstRegion.getRegionServerServices().isAborted()); LOG.info("isStopped = " + firstRegion.getRegionServerServices().isStopped()); assertTrue(firstRegion.getRegionServerServices().isStopped()); }
LOG.info("Loading test table"); List<HRegion> testRegions = TEST_UTIL.getMiniHBaseCluster().findRegionsForTable(TABLE_NAME); assertEquals(1, testRegions.size()); compactingRegion = (CompactionBlockerRegion)testRegions.get(0);
@Test public void test() throws Exception { doIncrement(0); assertSum(); // we do not hack scan operation so using scan we could get the original values added into the // table. try (ResultScanner scanner = TABLE.getScanner(new Scan().withStartRow(ROW) .withStopRow(ROW, true).addFamily(FAMILY).readAllVersions().setAllowPartialResults(true))) { Result r = scanner.next(); assertTrue(r.rawCells().length > 2); } UTIL.flush(NAME); HRegion region = UTIL.getHBaseCluster().findRegionsForTable(NAME).get(0); HStore store = region.getStore(FAMILY); for (;;) { region.compact(true); if (store.getStorefilesCount() == 1) { break; } } assertSum(); // Should only have two cells after flush and major compaction try (ResultScanner scanner = TABLE.getScanner(new Scan().withStartRow(ROW) .withStopRow(ROW, true).addFamily(FAMILY).readAllVersions().setAllowPartialResults(true))) { Result r = scanner.next(); assertEquals(2, r.rawCells().length); } } }
@Test public void test() throws Exception { doIncrement(0); assertSum(); // we do not hack scan operation so using scan we could get the original values added into the // table. try (ResultScanner scanner = TABLE.getScanner(new Scan().withStartRow(ROW) .withStopRow(ROW, true).addFamily(FAMILY).readAllVersions().setAllowPartialResults(true))) { Result r = scanner.next(); assertTrue(r.rawCells().length > 2); } UTIL.flush(NAME); HRegion region = UTIL.getHBaseCluster().findRegionsForTable(NAME).get(0); HStore store = region.getStore(FAMILY); for (;;) { region.compact(true); if (store.getStorefilesCount() == 1) { break; } } assertSum(); // Should only have two cells after flush and major compaction try (ResultScanner scanner = TABLE.getScanner(new Scan().withStartRow(ROW) .withStopRow(ROW, true).addFamily(FAMILY).readAllVersions().setAllowPartialResults(true))) { Result r = scanner.next(); assertEquals(2, r.rawCells().length); } } }