google / google/leveldb

questions about leveldb::RepairDB

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

Description

Hi,
I have two questions about process crash or system crash during leveldb::RepairDB

1. In the flow Repairer::Run -> Repairer::WriteDescriptor.
In my understanding, 000001.dbtmp is created as a temporary file to store VersionSet information, then RenameFile to MANIFEST-000001. If the process crash before RenameFile called. the 000001.dbtmp left.
Is it possible that we fail to recover db in next time because of 000001.dbtmp exist ?
```c++
Status WriteDescriptor() {
std::string tmp = TempFileName(dbname_, 1);
WritableFile* file;
Status status = env_->NewWritableFile(tmp, &file);
if (!status.ok()) {
return status;
}
...
}
```

If yes, is it safe that I delete the [0-9]+.dbtmp before Open db?

2. When log.AddRecord(record) to 000001.dbtmp, EmitPhysicalRecord call Flush() to system buffer.
Is it content safe if system crash after RenameFile(000001.dbtmp, MANIFEST-000001).

Please forgive me if I misunderstand the code flow about recovery process.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.