From 0824d7819743e50acdb195fd3f9e01a2e5862585 Mon Sep 17 00:00:00 2001 From: anastas Date: Sat, 31 Mar 2018 15:00:48 +0300 Subject: [PATCH] Returning the option to config index type in CompactingMemStore --- .../hadoop/hbase/regionserver/CompactingMemStore.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactingMemStore.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactingMemStore.java index d874b2e779..9d4b92f873 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactingMemStore.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactingMemStore.java @@ -62,6 +62,12 @@ public class CompactingMemStore extends AbstractMemStore { public static final String IN_MEMORY_FLUSH_THRESHOLD_FACTOR_KEY = "hbase.memstore.inmemoryflush.threshold.factor"; private static final double IN_MEMORY_FLUSH_THRESHOLD_FACTOR_DEFAULT = 0.1; + // The external setting of the compacting MemStore behaviour + public static final String COMPACTING_MEMSTORE_INDEX_KEY = + "hbase.hregion.compacting.memstore.index"; + // usage of CellArrayMap is default, later it will be decided how to use CellChunkMap + public static final String COMPACTING_MEMSTORE_INDEX_DEFAULT = + String.valueOf(IndexType.NOT_DEFINED); private static final Logger LOG = LoggerFactory.getLogger(CompactingMemStore.class); private HStore store; @@ -86,7 +92,8 @@ public class CompactingMemStore extends AbstractMemStore { public enum IndexType { CSLM_MAP, // ConcurrentSkipLisMap ARRAY_MAP, // CellArrayMap - CHUNK_MAP // CellChunkMap + CHUNK_MAP, // CellChunkMap + NOT_DEFINED } private IndexType indexType = IndexType.ARRAY_MAP; // default implementation @@ -115,6 +122,13 @@ public class CompactingMemStore extends AbstractMemStore { } else { indexType = IndexType.ARRAY_MAP; } + if (IndexType.NOT_DEFINED != IndexType.valueOf(conf.get( + CompactingMemStore.COMPACTING_MEMSTORE_INDEX_KEY, + CompactingMemStore.COMPACTING_MEMSTORE_INDEX_DEFAULT))){ + // if user has defined the index type manually it overwrites the defaults + indexType = IndexType.valueOf(conf.get(CompactingMemStore.COMPACTING_MEMSTORE_INDEX_KEY, + CompactingMemStore.COMPACTING_MEMSTORE_INDEX_DEFAULT)); + } // initialization of the flush size should happen after initialization of the index type // so do not transfer the following method initInmemoryFlushSize(conf); -- 2.14.3 (Apple Git-98)