mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-07 17:24:24 +01:00
Merge 'sorter: fix sorter panic on SortedChunkIOState::WaitingForRead' from Jussi Saurio
Closes #2165 The following sequence of events is possible: - init_chunk_heap() called - flush() gets called, and all chunks start writing to disk - chunk A status is WriteComplete, so chunk.read() gets called on chunk A - chunk A sets its status to WaitingForRead - some other chunk B is still in WaitingForWrite status after flush() - for this reason, init_chunk_heap() returns IOResult::IO - init_chunk_heap() is called again - we panic because chunk A is in WaitingForRead status So - we just allow WaitingForRead status in init_chunk_heap() instead. This panic was caught thanks to Pedro's IO latency enhancement to the sim! Reviewed-by: Iaroslav Zeigerman (@izeigerman) Closes #2166
This commit is contained in:
@@ -149,7 +149,7 @@ impl Sorter {
|
||||
// Write complete, we can now read from the chunk.
|
||||
chunk.read()?;
|
||||
}
|
||||
SortedChunkIOState::WaitingForWrite => {
|
||||
SortedChunkIOState::WaitingForWrite | SortedChunkIOState::WaitingForRead => {
|
||||
all_read_complete = false;
|
||||
}
|
||||
SortedChunkIOState::ReadEOF | SortedChunkIOState::ReadComplete => {}
|
||||
|
||||
Reference in New Issue
Block a user