HBASE-14257 Periodic flusher only handles hbase:meta, not other system tables. (Abhishek)
This commit is contained in:
parent
ac746e0905
commit
4269c7fe69
|
@ -1307,7 +1307,8 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
|
||||||
"hbase.regionserver.optionalcacheflushinterval";
|
"hbase.regionserver.optionalcacheflushinterval";
|
||||||
/** Default interval for the memstore flush */
|
/** Default interval for the memstore flush */
|
||||||
public static final int DEFAULT_CACHE_FLUSH_INTERVAL = 3600000;
|
public static final int DEFAULT_CACHE_FLUSH_INTERVAL = 3600000;
|
||||||
public static final int META_CACHE_FLUSH_INTERVAL = 300000; // 5 minutes
|
/** Default interval for System tables memstore flush */
|
||||||
|
public static final int SYSTEM_CACHE_FLUSH_INTERVAL = 300000; // 5 minutes
|
||||||
|
|
||||||
/** Conf key to force a flush if there are already enough changes for one region in memstore */
|
/** Conf key to force a flush if there are already enough changes for one region in memstore */
|
||||||
public static final String MEMSTORE_FLUSH_PER_CHANGES =
|
public static final String MEMSTORE_FLUSH_PER_CHANGES =
|
||||||
|
@ -1995,9 +1996,9 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
long modifiedFlushCheckInterval = flushCheckInterval;
|
long modifiedFlushCheckInterval = flushCheckInterval;
|
||||||
if (getRegionInfo().isMetaRegion() &&
|
if (getRegionInfo().isSystemTable() &&
|
||||||
getRegionInfo().getReplicaId() == HRegionInfo.DEFAULT_REPLICA_ID) {
|
getRegionInfo().getReplicaId() == HRegionInfo.DEFAULT_REPLICA_ID) {
|
||||||
modifiedFlushCheckInterval = META_CACHE_FLUSH_INTERVAL;
|
modifiedFlushCheckInterval = SYSTEM_CACHE_FLUSH_INTERVAL;
|
||||||
}
|
}
|
||||||
if (modifiedFlushCheckInterval <= 0) { //disabled
|
if (modifiedFlushCheckInterval <= 0) { //disabled
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -944,10 +944,10 @@ public class TestDefaultMemStore extends TestCase {
|
||||||
|
|
||||||
public void testShouldFlushMeta() throws Exception {
|
public void testShouldFlushMeta() throws Exception {
|
||||||
// write an edit in the META and ensure the shouldFlush (that the periodic memstore
|
// write an edit in the META and ensure the shouldFlush (that the periodic memstore
|
||||||
// flusher invokes) returns true after META_CACHE_FLUSH_INTERVAL (even though
|
// flusher invokes) returns true after SYSTEM_CACHE_FLUSH_INTERVAL (even though
|
||||||
// the MEMSTORE_PERIODIC_FLUSH_INTERVAL is set to a higher value)
|
// the MEMSTORE_PERIODIC_FLUSH_INTERVAL is set to a higher value)
|
||||||
Configuration conf = new Configuration();
|
Configuration conf = new Configuration();
|
||||||
conf.setInt(HRegion.MEMSTORE_PERIODIC_FLUSH_INTERVAL, HRegion.META_CACHE_FLUSH_INTERVAL * 10);
|
conf.setInt(HRegion.MEMSTORE_PERIODIC_FLUSH_INTERVAL, HRegion.SYSTEM_CACHE_FLUSH_INTERVAL * 10);
|
||||||
HBaseTestingUtility hbaseUtility = HBaseTestingUtility.createLocalHTU(conf);
|
HBaseTestingUtility hbaseUtility = HBaseTestingUtility.createLocalHTU(conf);
|
||||||
Path testDir = hbaseUtility.getDataTestDir();
|
Path testDir = hbaseUtility.getDataTestDir();
|
||||||
EnvironmentEdgeForMemstoreTest edge = new EnvironmentEdgeForMemstoreTest();
|
EnvironmentEdgeForMemstoreTest edge = new EnvironmentEdgeForMemstoreTest();
|
||||||
|
@ -969,7 +969,7 @@ public class TestDefaultMemStore extends TestCase {
|
||||||
edge.setCurrentTimeMillis(1234 + 100);
|
edge.setCurrentTimeMillis(1234 + 100);
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
assertTrue(meta.shouldFlush(sb) == false);
|
assertTrue(meta.shouldFlush(sb) == false);
|
||||||
edge.setCurrentTimeMillis(edge.currentTime() + HRegion.META_CACHE_FLUSH_INTERVAL + 1);
|
edge.setCurrentTimeMillis(edge.currentTime() + HRegion.SYSTEM_CACHE_FLUSH_INTERVAL + 1);
|
||||||
assertTrue(meta.shouldFlush(sb) == true);
|
assertTrue(meta.shouldFlush(sb) == true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue