Skip to content

questions about leveldb::RepairDB #630

@minggrim

Description

@minggrim

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 ?
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?

  1. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions