/** * Flush the cache. * * <p>When this method is called the cache will be flushed unless: * <ol> * <li>the cache is empty</li> * <li>the region is closed.</li> * <li>a flush is already in progress</li> * <li>writes are disabled</li> * </ol> * * <p>This method may block for some time, so it should not be called from a * time-sensitive thread. * @param force whether we want to force a flush of all stores * @return FlushResult indicating whether the flush was successful or not and if * the region needs compacting * * @throws IOException general io exceptions * because a snapshot was not properly persisted. */ // TODO HBASE-18905. We might have to expose a requestFlush API for CPs public FlushResult flush(boolean force) throws IOException { return flushcache(force, false, FlushLifeCycleTracker.DUMMY); }
try { notifyFlushRequest(region, emergencyFlush); FlushResult flushResult = region.flushcache(forceFlushAllStores, false, tracker); boolean shouldCompact = flushResult.isCompactionNeeded();
FlushResult fs = flushcache(true, false, FlushLifeCycleTracker.DUMMY); if (fs.isFlushSucceeded()) { seqId = ((FlushResultImpl)fs).flushSequenceId;
put.addColumn(cf1, col, Bytes.toBytes("val")); region.put(put); region.flushcache(true, true, FlushLifeCycleTracker.DUMMY); Put put2 = new Put(Bytes.toBytes("19997")); put2.addColumn(cf1, col, Bytes.toBytes("val")); region.put(p); region.flushcache(true, true, FlushLifeCycleTracker.DUMMY);
region.flushcache(true, true, FlushLifeCycleTracker.DUMMY);
public void testWriteFlushRequestMarker() throws IOException { FlushResultImpl result = primaryRegion.flushcache(true, false, FlushLifeCycleTracker.DUMMY); assertNotNull(result); assertEquals(FlushResultImpl.Result.CANNOT_FLUSH_MEMSTORE_EMPTY, result.result); result = primaryRegion.flushcache(true, true, FlushLifeCycleTracker.DUMMY); assertNotNull(result); assertEquals(FlushResultImpl.Result.CANNOT_FLUSH_MEMSTORE_EMPTY, result.result);
/** * Test the case where the secondary region replica is not in reads enabled state because it is * waiting for a flush or region open marker from primary region. Replaying CANNOT_FLUSH * flush marker entry should restore the reads enabled status in the region and allow the reads * to continue. */ @Test public void testReplayingFlushRequestRestoresReadsEnabledState() throws IOException { disableReads(secondaryRegion); // Test case 1: Test that replaying CANNOT_FLUSH request marker assuming this came from // triggered flush restores readsEnabled primaryRegion.flushcache(true, true, FlushLifeCycleTracker.DUMMY); reader = createWALReaderForPrimary(); while (true) { WAL.Entry entry = reader.next(); if (entry == null) { break; } FlushDescriptor flush = WALEdit.getFlushDescriptor(entry.getEdit().getCells().get(0)); if (flush != null) { secondaryRegion.replayWALFlushMarker(flush, entry.getKey().getSequenceId()); } } // now reads should be enabled secondaryRegion.get(new Get(Bytes.toBytes(0))); }
region.flushcache(true, writeFlushWalMarker, FlushLifeCycleTracker.DUMMY); boolean compactionNeeded = flushResult.isCompactionNeeded(); if (compactionNeeded) {
/** * Flushes the given region */ public void flushRegion(byte[] regionName) throws IllegalArgumentException, IOException { HRegion region = getOnlineRegion(regionName); if (region == null) { throw new IllegalArgumentException("No region : " + new String(regionName) + " available"); } region.flushcache(); }
/** * Flushes the given region if lastFlushTime < ifOlderThanTS */ public void flushRegion(byte[] regionName, long ifOlderThanTS) throws IllegalArgumentException, IOException { HRegion region = getOnlineRegion(regionName); if (region == null) { throw new IllegalArgumentException("No region : " + new String(regionName) + " available"); } if (region.getLastFlushTime() < ifOlderThanTS) region.flushcache(); }
@Override public void run() { try { region.flushcache(true, false); } catch (IOException e) { throw Throwables.propagate(e); } } };
@Override public void run() { try { region.flushcache(true, false); } catch (IOException e) { throw Throwables.propagate(e); } } };
@Override public void run() { try { region.flushcache(); } catch (IOException e) { throw Throwables.propagate(e); } } };
@Override public void run() { try { region.flushcache(); } catch (IOException e) { throw Throwables.propagate(e); } } };
@Override public boolean flush() throws IOException { // we flush all stores and don't write flush request marker to WAL. This mimics the flush behavior which we // have in older versions. HRegion.FlushResult result = region.flushcache(true, false); return result.isCompactionNeeded(); }
@Override public boolean flush() throws IOException { HRegion.FlushResult result = region.flushcache(); return result.isCompactionNeeded(); }
@Override public boolean flush() throws IOException { // we flush all stores and don't write flush request marker to WAL. This mimics the flush behavior which we // have in older versions. HRegion.FlushResult result = region.flushcache(true, false); return result.isCompactionNeeded(); }
@Override public boolean flush() throws IOException { HRegion.FlushResult result = region.flushcache(); return result.isCompactionNeeded(); }
@Override public boolean flush() throws IOException { HRegion.FlushResult result = region.flushcache(); return result.isCompactionNeeded(); }
@Override @QosPriority(priority=HConstants.HIGH_QOS) public void flushRegion(HRegionInfo regionInfo) throws NotServingRegionException, IOException { checkOpen(); LOG.info("Flushing " + regionInfo.getRegionNameAsString()); HRegion region = getRegion(regionInfo.getRegionName()); region.flushcache(); }