• N
    In-place updates for equal keys and similar sized values · fe250702
    Naman Gupta 提交于
    Summary:
    Currently for each put, a fresh memory is allocated, and a new entry is added to the memtable with a new sequence number irrespective of whether the key already exists in the memtable. This diff is an attempt to update the value inplace for existing keys. It currently handles a very simple case:
    1. Key already exists in the current memtable. Does not inplace update values in immutable memtable or snapshot
    2. Latest value type is a 'put' ie kTypeValue
    3. New value size is less than existing value, to avoid reallocating memory
    
    TODO: For a put of an existing key, deallocate memory take by values, for other value types till a kTypeValue is found, ie. remove kTypeMerge.
    TODO: Update the transaction log, to allow consistent reload of the memtable.
    
    Test Plan: Added a unit test verifying the inplace update. But some other unit tests broken due to invalid sequence number checks. WIll fix them next.
    
    Reviewers: xinyaohu, sumeet, haobo, dhruba
    
    CC: leveldb
    
    Differential Revision: https://reviews.facebook.net/D12423
    
    Automatic commit by arc
    fe250702
memtable.h 5.9 KB