Skip to content

Commit

Permalink
fix: fix a bug in iterator that no file found
Browse files Browse the repository at this point in the history
Signed-off-by: arkbriar <[email protected]>
  • Loading branch information
arkbriar committed Sep 9, 2024
1 parent b8b46eb commit f9af954
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions internal/filechannel/filechannel.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,14 @@ func (it *Iterator) openPlainFile() error {
}

func (it *Iterator) openFile() error {
err := it.openCompressedFile()
// Open plain file first. If it's not found, then the compressed file must have been
// created. If the compressed file is not found, it's an error. Guaranteed by the
// compression algorithm:
// rename(compressing, compressed)
// delete(plain)
err := it.openPlainFile()
if os.IsNotExist(err) {
return it.openPlainFile()
return it.openCompressedFile()
}
return err
}
Expand Down

0 comments on commit f9af954

Please sign in to comment.