Fix incorrect flush after truncate, other improvements#99
Conversation
Zero the full slice of removed data, not just the first 16 bytes
0411076 to
d32ae09
Compare
d32ae09 to
827edcc
Compare
|
|
||
| thread::spawn(move || { | ||
| trace!("{log_msg}"); | ||
| error!("{log_msg}"); |
There was a problem hiding this comment.
maybe warn? error should mean something unexpected happened, but as I understood, this path is possible
There was a problem hiding this comment.
Of wait, is that expected that with new changes this path is an actual error?
There was a problem hiding this comment.
With the new changes it should be impossible to hit this branch. That's why I promoted it to an error.
Still want to demote it to a warning?
| /// | ||
| /// The entries are not guaranteed to be removed until the segment is | ||
| /// flushed. | ||
| pub fn truncate(&mut self, from: usize) { |
There was a problem hiding this comment.
Can you please write a basic unit test for this function.
It seems to be completely uncovered.
There was a problem hiding this comment.
There is a function that covers it:
Lines 1104 to 1211 in 95c4310
But it doesn't hurt to add a bit more testing.
I cannot fully assert the actual flush behavior to disk though, since the kernel takes care of this in a non-deterministic way.
We must only move it back, and not forward. Data starting at the current flush offset may still not be flushed.
Fix incorrect flush after truncate, because
flush_offsetwas not bumped when truncating. This also improves or simplifies other things.I'd recommend to review this PR per commit.
These changes have been tested as described in qdrant/qdrant#7577.
Before this PR I repeatedly see the following log line:
which indicates flushing errors. This PR resolves the issue and I haven't seen that log line since.