Skip to content

[V2] In-place value updates #4

@bravo1goingdark

Description

@bravo1goingdark

Summary

Support in-place value updates instead of rejecting duplicate inserts.

Motivation

Currently, inserting a key that already exists returns DuplicateKey error. For some use cases, you may want to update the value in place without creating a new node.

Current Behavior

sl.insert(b"key", b"value1");
sl.insert(b"key", b"value2"); // Returns false, DuplicateKey error

Desired Behavior

sl.insert(b"key", b"value1");
sl.update(b"key", b"value2"); // Updates value in place, returns old value

Or alternatively, make insert have an update mode:

sl.insert(b"key", b"value1");
sl.insert(b"key", b"value2", UpdateMode::Overwrite); // Updates value

Implementation Notes

The design doc mentions "update value (or insert tombstone version for MVCC)" but we went with MVCC approach (seal + fresh memtable). An in-place update could be added as an alternative.

From design doc

See LOCKFREE_SKIPLIST_DESIGN.md lines 191-192

Priority: low

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions