Skip to content

[Performance]: Embedding branch reviewed by codex #11

Description

@JerryLX

Describe your performance question

After BuildIndex(), IndexObject::Lookup() returns the BBHash minimal-perfect-hash slot, not the original insertion position in
valueVec_. For any non-trivial bucket where PHF slots differ from append order, this line reads the wrong value for an existing key,
silently corrupting post-index lookups; the values need to be laid out by PHF slot or an additional PHF-slot-to-vector-index mapping
must be stored.

  • [P1] Avoid put_from on heap-backed ShareObject buffers — Mooncake/mooncake-embtable-store/src/share_object/
    share_object.cpp:75-75
    ShareObject::Create() allocates local_buffer_ with new char[], but RealClient::put_from() requires the source pointer to be Store-
    managed/registered memory. Publishing keys, values, indexes, and metadata through this path will fail for normal heap buffers; use the
    copying put API or allocate/register buffers through RealClient before calling put_from.

  • [P1] Store table metadata without put_from heap strings — Mooncake/mooncake-embtable-store/src/emb_table/
    emb_table_meta.cpp:29-30
    The serialized metadata lives in a normal std::string, but RealClient::put_from() only accepts Store-managed/registered buffers. With
    createNew=true, EmbTableClient::Init() will fail while creating table metadata even before bucket data is inserted; use RealClient::put
    or a registered buffer for this payload.

  • [P2] Accept successful positive get_into lengths — Mooncake/mooncake-embtable-store/src/emb_table/emb_table_meta.cpp:45-46
    get_into() returns the number of bytes read on success, so an existing non-empty metadata object returns a positive value and is
    currently treated as kNotFound. This breaks Init(createNew=false) for any persisted table metadata; check for < 0 and deserialize only
    the returned byte range.

  • [P2] Treat missing bucket maps as empty during reads/builds — Mooncake/mooncake-embtable-store/src/share_map_store/
    share_map_store.cpp:68-69
    Passing valueSize == 0 makes getOrCreateShareMap() return kNotFound when a bucket has never received inserts. As a result, Find() fails
    instead of returning empty views for keys routed to empty buckets, and BuildIndex() fails for any table where at least one pre-created
    bucket is empty, which is common when there are more buckets than populated hash partitions.

Before submitting a new issue...

  • Make sure you already searched for relevant issues and read the documentation

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