Closed kev1n80 closed 3 years ago
Yes, those edge cases are possible. What we do is perform checks when you reach the tail of the queue:
Hello, I'm not sure if I should make a new issue or respond here. I found that in the case where the user is reading all of the messages in the queue and the last file is corrupted, the depth never becomes 0. Within the if clause in line 579, the readFileNum == the writeFileNum and writePos is set to 0 as is the readPos later on in the function. After the readPos is set to 0, shouldn't checkTailCorruption
be called or depth be set to 0 if readFileNum == writeFileNum?
Yea, you're right, we should call d.checkTailCorruption(d.depth)
at the end of handleReadError()
, want to open a PR?
Yes I would love to open a PR and add the change: call d.checkTailCorruption(d.depth)
at the end of handleReadError()
. Thank you!
It seems like DiskQueue does not accurately update depth when a read error occurs (in handleReadError()) or in the scenario where the machine finishes reading a file, deletes a file, but crashes before writing to the MetaData file.