We are now using memstore.heapSize() + memstore.offheapSize() to decide whether a flush is needed. But, if a same cell was put again in memstore, only the memstore's dataSize will be increased, the heap/offheap size won't. We encountered the problem that a user was putting the same kv again and again, but the memstore won't flush since the heap size was not counted properly. The RS was killed by system since not enough memory in the end.
Actually, if MSLAB is used, the heap/offheap will increase no matter the cell is added or not. IIRC, memstore's heap/offheap size should always bigger than data size. We introduced heap/offheap size besides data size in order to reflect memory footprint more precisely.