Skip to content

Rust project 4: multithreading bug during KVStore compaction #461

@RPallas92

Description

@RPallas92

Bug Report

During compaction, we copy all the data from the logs to be compacted to the new compacted log (code pointer).

After that, we update the lock-free index (code pointer). At this point, readers will start reading these values from the new compacted log as the lock-free index has been updated.

The issue is we are using a buffered writer, that we flush after all data has been copied (code pointer).

Issue

In between we update the index and we flush the buffered writer, all lock-free readers will try to get data from the compaction log, that is not flushed. Get operations will return key not found error.

Expected behaviour

Lock-free readers don´t return key not found if the key exists.

Shouldn´t we flush the buffered writer before updating the index?

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions