From 80df1d9835fcdb22b1a53ddc9cc03e368263e593 Mon Sep 17 00:00:00 2001 From: PSeitz Date: Tue, 25 Apr 2023 15:20:33 +0800 Subject: [PATCH] Handle error for exists on MMapDirectory (#1988) `exists` will return false in case of other io errors, like permission denied --- src/directory/mmap_directory.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/directory/mmap_directory.rs b/src/directory/mmap_directory.rs index 11887a30a3..537eb95e37 100644 --- a/src/directory/mmap_directory.rs +++ b/src/directory/mmap_directory.rs @@ -369,7 +369,9 @@ impl Directory for MmapDirectory { fn exists(&self, path: &Path) -> Result { let full_path = self.resolve_path(path); - Ok(full_path.exists()) + full_path + .try_exists() + .map_err(|io_err| OpenReadError::wrap_io_error(io_err, path.to_path_buf())) } fn open_write(&self, path: &Path) -> Result {