Skip to content

Potential Manifest and Log File ID Conflict During Recovery Process in LevelDB #1193

Open
@owenliang

Description

@owenliang

In the function Status VersionSet::Recover(bool* save_manifest), the statement manifest_file_number_ = next_file; could potentially lead to a scenario where the identifier of the manifest file matches that of the log file for the memtable. The chronological sequence of events that might give rise to this situation is outlined as follows:

Memtable Writing: The memtable is actively being written to (with the log file at ID 4 and next_file_num set to 5), while the immutable memtable (imm) is empty.

Compaction Occurs: A compaction process consolidates SST files, and within the edit log, next_file_number_ is recorded as 5.

Memtable Switch: The memtable becomes full, triggering a switch to a new log file (now at ID 5, with next_file_num advanced to 6), and the filled memtable is moved to the imm state.

Database Restart: The database undergoes a restart.

Recovery Process: During VersionSet::Recover(), the edit log with next_file_number_ as 5 is read, prompting the creation and redoing of the manifest file using the ID 5.

Overlap Identified: Consequently, both the manifest file and the log file now share the same identifier, which is 5.

While this overlap in identifiers does not impede the functional operation of the database, I seek confirmation on whether this particular sequence of events is plausible. Thank you for your attention to this matter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions