google / google/leveldb

Question: Each KV pair has 2 copies in arena?

Open
#1,148 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
39.4k
Forks
8.2k
PR merge metrics
No merged PRs in 30d

Description

I'm a C++ beginner, please correct me if I was wrong.
Is it possible to save a pointer to Key rather than a Key object in node?

First copy:
MemTable::Add(): char* buf = arena_.**Allocate**(encoded_len);

Second copy:
template
struct SkipList::Node {
explicit Node(const Key& k) : **key(k)** {}

Key const key;
...
}

Contributor guide

Open the contributing guide

Research direction

Start with MemTable::Add() and the SkipList::Node definition shown in the issue. Trace how the arena-allocated buffer and the node's key are used, including their lifetimes and ownership. Done means establishing whether storing a pointer is safe and documenting the required change or why the existing representation should remain.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
database
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.