Bug: NewAppendableFile does not record newly created FileState in file_map_
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
Research direction
Start in helpers/memenv/memenv.cc at InMemoryEnv::NewAppendableFile, then inspect how file_map_ and FileState are handled by nearby methods. Verify the change with the existing memenv tests if available; done means a newly created appendable file remains associated with its filename in file_map_.
Written by the indexing model from the issue text.
Description
Issue Description
I found a potential bug in helpers/memenv/memenv.cc in the InMemoryEnv::NewAppendableFile method.
Location
helpers/memenv/memenv.cc, lines 276-287
Problem
When a new appendable file is created (i.e., the file does not exist in file_map_), a new FileState object is instantiated and referenced. However, the new FileState is never assigned back to the file_map_, breaking the association between the filename and the FileState object.
Current Code
Status NewAppendableFile(const std::string& fname,
WritableFile** result) override {
MutexLock lock(&mutex_);
FileState** sptr = &file_map_[fname];
FileState* file = *sptr;
if (file == nullptr) {
file = new FileState();
file->Ref();
// BUG: Missing assignment back to file_map_
}
*result = new WritableFileImpl(file);
return Status::OK();
}
- Dominant language
- C++
- Stars
- 39.4k
- Forks
- 8.2k
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from google/leveldb
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 1/5 Under an hour Newbie friendliness 65/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
games-on-whales/wolf#509 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NVIDIA/cuda-samples#453 ·