From 015db0a7aa97398ceae79bd9d5fd34aec1bdc463 Mon Sep 17 00:00:00 2001 From: Ramkrishna Date: Thu, 26 Oct 2017 10:44:59 +0530 Subject: [PATCH] HBASE-18994 Decide if META/System tables should use Compacting Memstore or Default Memstore (Ram) --- .../hadoop/hbase/regionserver/HStore.java | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java index 52db6997f03..c0cea4e1526 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java @@ -264,24 +264,30 @@ public class HStore implements Store, HeapSize, StoreConfigInformation, Propagat // Why not just pass a HColumnDescriptor in here altogether? Even if have // to clone it? scanInfo = new ScanInfo(conf, family, ttl, timeToPurgeDeletes, this.comparator); - MemoryCompactionPolicy inMemoryCompaction = family.getInMemoryCompaction(); - if(inMemoryCompaction == null) { - inMemoryCompaction = MemoryCompactionPolicy.valueOf( - conf.get(CompactingMemStore.COMPACTING_MEMSTORE_TYPE_KEY, - CompactingMemStore.COMPACTING_MEMSTORE_TYPE_DEFAULT)); + MemoryCompactionPolicy inMemoryCompaction = null; + if (this.getTableName().isSystemTable()) { + inMemoryCompaction = MemoryCompactionPolicy + .valueOf(conf.get("hbase.systemtables.compacting.memstore.type", "NONE")); + } else { + inMemoryCompaction = family.getInMemoryCompaction(); + } + if (inMemoryCompaction == null) { + inMemoryCompaction = + MemoryCompactionPolicy.valueOf(conf.get(CompactingMemStore.COMPACTING_MEMSTORE_TYPE_KEY, + CompactingMemStore.COMPACTING_MEMSTORE_TYPE_DEFAULT)); } String className; switch (inMemoryCompaction) { - case BASIC : - case EAGER : - Class clz = conf.getClass(MEMSTORE_CLASS_NAME, - CompactingMemStore.class, CompactingMemStore.class); - className = clz.getName(); - this.memstore = ReflectionUtils.newInstance(clz, new Object[] { conf, this.comparator, this, - this.getHRegion().getRegionServicesForStores(), inMemoryCompaction}); - break; - case NONE : - default: + case BASIC: + case EAGER: + Class clz = + conf.getClass(MEMSTORE_CLASS_NAME, CompactingMemStore.class, CompactingMemStore.class); + className = clz.getName(); + this.memstore = ReflectionUtils.newInstance(clz, new Object[] { conf, this.comparator, this, + this.getHRegion().getRegionServicesForStores(), inMemoryCompaction }); + break; + case NONE: + default: className = DefaultMemStore.class.getName(); this.memstore = ReflectionUtils.newInstance(DefaultMemStore.class, new Object[] { conf, this.comparator });