google / google/leveldb

Incorrect comments about key length in MemTable

Open
#1,281 2 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

1. ​​Incorrect comment in MemTable::Get​​

```
// entry format is:
// klength varint32
// userkey char[klength] // ← Problem here
// tag uint64
// vlength varint32
// value char[vlength]
```

**Fix**: `userkey char[klength - 8]`.

2. ​​Incorrect comment in MemTable::Add​​

```
// Format of an entry is concatenation of:
// key_size : varint32 of internal_key.size()
// key bytes : char[internal_key.size()] // ← Problem here
// tag : uint64((sequence << 8) | type)
// value_size : varint32 of value.size()
// value bytes : char[value.size()]
```

**Fix**: `key bytes : char[key.size()] `.

Contributor guide

Open the contributing guide

Research direction

Search the C++ sources for MemTable::Get and MemTable::Add, then inspect the nearby entry-format comments. Update the two documented key-length expressions to match the issue, and verify that both comments describe the actual entry layout.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
databases
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.