@Override public boolean requestFlush(HRegion region, boolean force, FlushLifeCycleTracker tracker) { try { r.flush(force); return true; } catch (IOException e) { throw new RuntimeException("Exception flushing", e); } }
@Override public void run() { try { region.flush(true); LOG.info("Finishing flush"); } catch (IOException e) { LOG.info("Failed flush cache"); } } };
@Override public void run() { while (!appendDone.get()) { try { region.flush(true); } catch (Exception e) { e.printStackTrace(); } } } };
@Override public void run() { while (!incrementDone.get()) { try { region.flush(true); } catch (Exception e) { e.printStackTrace(); } } } };
@Override public Void call() throws Exception { LOG.debug("Starting region operation on " + region); region.startRegionOperation(); try { LOG.debug("Flush region " + region.toString() + " started..."); region.flush(true); // TODO: flush result is not checked? } finally { LOG.debug("Closing region operation on " + region); region.closeRegionOperation(); } return null; } }
@Override public void run() { try { HRegion.FlushResult flushResult = region.flush(true); LOG.info("Flush result:" + flushResult.getResult()); LOG.info("Flush succeeded:" + flushResult.isFlushSucceeded()); flushFinished.countDown(); } catch (IOException e) { LOG.error(e.toString(), e); } } });
private void createSmallerStoreFile(final HRegion region) throws IOException { Table loader = new RegionAsTable(region); HBaseTestCase.addContent(loader, Bytes.toString(COLUMN_FAMILY), Bytes.toBytes("" + "bbb"), null); region.flush(true); }
/** * Create a new hfile in the passed region * @param region region to operate on * @param columnFamily family for which to add data * @throws IOException */ private void createHFileInRegion(HRegion region, byte[] columnFamily) throws IOException { // put one row in the region Put p = new Put(Bytes.toBytes("row")); p.addColumn(columnFamily, Bytes.toBytes("Qual"), Bytes.toBytes("v1")); region.put(p); // flush the region to make a store file region.flush(true); }
@Override public void run() { try { if (region.getMemStoreDataSize() <= 0) { throw new IOException("memstore size=" + region.getMemStoreDataSize()); } region.flush(false); } catch (IOException e) { // Can fail trying to flush in middle of a roll. Not a failure. Will succeed later // when roll completes. LOG.info("In flush", e); } LOG.info("Exiting"); } };
private void executeFlush(HRegion region) throws IOException { // retry 5 times if we can not flush for (int i = 0; i < 5; i++) { FlushResult result = region.flush(true); if (result.getResult() != FlushResult.Result.CANNOT_FLUSH) { return; } Threads.sleep(1000); } }
private void createStoreFile(final HRegion region, String family) throws IOException { Table loader = new RegionAsTable(region); HBaseTestCase.addContent(loader, family); region.flush(true); }
private void createStoreFile(final HRegion region, String family) throws IOException { Table loader = new RegionAsTable(region); HBaseTestCase.addContent(loader, family); region.flush(true); }
private static void loadDataToRegion(HRegion region, byte[] additionalFamily) throws IOException { for (int i = 0; i < ROWSIZE; i++) { Put put = new Put(ROWS[i]); for (int j = 0; j < QUALSIZE; j++) { put.add(makeKV(i, j)); // put additional family put.add(makeKV(i, j, additionalFamily)); } region.put(put); if (i == ROWSIZE / 3 || i == ROWSIZE * 2 / 3) { region.flush(true); } } }
private void createStoreFile(int[] colIds) throws IOException { Put p = new Put(ROW_BYTES); for (int colId : colIds) { long ts = Long.MAX_VALUE; String qual = qualFromId(colId); allColIds.add(colId); KeyValue kv = KeyValueTestUtil.create(ROW, FAMILY, qual, ts, TestMultiColumnScanner.createValue(ROW, qual, ts)); p.add(kv); } region.put(p); region.flush(true); }
@Override public void doAnAction() throws Exception { region.flush(true); // Compact regularly to avoid creating too many files and exceeding // the ulimit. region.compact(false); for (HStore store : region.getStores()) { store.closeAndArchiveCompactedFiles(); } } });
/** * Flush and log stats on flush * @param r * @param server * @throws IOException */ private void flush(final HRegion r, final HRegionServer server) throws IOException { LOG.info("Flush " + r.toString() + " on " + server.getServerName() + ", " + r.flush(true) + ", size=" + server.getRegionServerAccounting().getGlobalMemStoreDataSize()); }
/** Flush the given region in the mini cluster. Since no master, we cannot use HBaseAdmin.flush() */ public static void flushRegion(HBaseTestingUtility HTU, HRegionInfo regionInfo) throws IOException { for (RegionServerThread rst : HTU.getMiniHBaseCluster().getRegionServerThreads()) { HRegion region = rst.getRegionServer().getRegionByEncodedName(regionInfo.getEncodedName()); if (region != null) { region.flush(true); return; } } throw new IOException("Region to flush cannot be found"); }
@Before public void prepareRegion() throws IOException { region = TEST_UTIL.createTestRegion("TestTimestampFilterSeekHint" + regionCount++, new HColumnDescriptor(FAMILY) .setBlocksize(1024) .setMaxVersions(MAX_VERSIONS) ); for (long i = 0; i <MAX_VERSIONS - 2; i++) { Put p = new Put(RK_BYTES, i); p.addColumn(FAMILY_BYTES, QUAL_BYTES, Bytes.toBytes(RandomStringUtils.randomAlphabetic(255))); region.put(p); } region.flush(true); } }
@Override public void postPut(final ObserverContext<RegionCoprocessorEnvironment> c, final Put put, final WALEdit edit, final Durability durability) throws IOException { HRegion region = (HRegion) c.getEnvironment().getRegion(); super.postPut(c, put, edit, durability); if (Bytes.equals(put.getRow(), Bytes.toBytes("row2"))) { region.flush(false); Assert.assertTrue(region.getMemStoreDataSize() >= 0); } } }
@BeforeClass public static void setUpBeforeClass() throws Exception { cluster = TEST_UTIL.startMiniCluster(ServerNum); table = TEST_UTIL.createTable(tableName, FAMILY, HBaseTestingUtility.KEYS_FOR_HBA_CREATE_TABLE); TEST_UTIL.waitTableAvailable(tableName, 1000); TEST_UTIL.loadTable(table, FAMILY); for (int i = 0; i < ServerNum; i++) { HRegionServer server = cluster.getRegionServer(i); for (HRegion region : server.getRegions(tableName)) { region.flush(true); } } finder.setConf(TEST_UTIL.getConfiguration()); finder.setServices(cluster.getMaster()); finder.setClusterMetrics(cluster.getMaster().getClusterMetrics()); }