Rust project 4: multithreading bug during KVStore compaction
RPallas92 opened this issue · 0 comments
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?