org.apache.hadoop.hbase.regionserver
Class MemStore

java.lang.Object
  extended by org.apache.hadoop.hbase.regionserver.MemStore
All Implemented Interfaces:
HeapSize

public class MemStore
extends Object
implements HeapSize

The MemStore holds in-memory modifications to the Store. Modifications are KeyValues. When asked to flush, current memstore is moved to snapshot and is cleared. We continue to serve edits out of new memstore and backing snapshot until flusher reports in that the flush succeeded. At this point we let the snapshot go. TODO: Adjust size of the memstore when we remove items because they have been deleted. TODO: With new KVSLS, need to make sure we update HeapSize with difference in KV size.


Nested Class Summary
protected  class MemStore.MemStoreScanner
           
 
Field Summary
static long DEEP_OVERHEAD
           
static long FIXED_OVERHEAD
           
 
Constructor Summary
MemStore()
          Default constructor.
MemStore(KeyValue.KVComparator c)
          Constructor.
 
Method Summary
 boolean get(QueryMatcher matcher, List<KeyValue> result)
          Perform a single-row Get on the and snapshot, placing results into the specified KV list.
 long heapSize()
          Get the entire heap usage for this MemStore not including keys in the snapshot.
 long keySize()
          Get the heap usage of KVs in this MemStore.
static void main(String[] args)
          Code to help figure if our approximation of object heap sizes is close enough.
 int numKeyValues()
          Get an estimate of the number of key values stored in this store.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FIXED_OVERHEAD

public static final long FIXED_OVERHEAD

DEEP_OVERHEAD

public static final long DEEP_OVERHEAD
Constructor Detail

MemStore

public MemStore()
Default constructor. Used for tests.


MemStore

public MemStore(KeyValue.KVComparator c)
Constructor.

Parameters:
c - Comparator
Method Detail

get

public boolean get(QueryMatcher matcher,
                   List<KeyValue> result)
Perform a single-row Get on the and snapshot, placing results into the specified KV list.

This will return true if it is determined that the query is complete and it is not necessary to check any storefiles after this.

Otherwise, it will return false and you should continue on.

Parameters:
matcher - Column matcher
result - List to add results to
Returns:
true if done with store (early-out), false if not

heapSize

public long heapSize()
Get the entire heap usage for this MemStore not including keys in the snapshot.

Specified by:
heapSize in interface HeapSize
Returns:
Approximate 'exclusive deep size' of implementing object. Includes count of payload and hosting object sizings.

keySize

public long keySize()
Get the heap usage of KVs in this MemStore.


numKeyValues

public int numKeyValues()
Get an estimate of the number of key values stored in this store.

Returns:
the number of key/values in this memstore.

main

public static void main(String[] args)
Code to help figure if our approximation of object heap sizes is close enough. See hbase-900. Fills memstores then waits so user can heap dump and bring up resultant hprof in something like jprofiler which allows you get 'deep size' on objects.

Parameters:
args - main args


Copyright © 2010 The Apache Software Foundation