pageserver: add hook for terminating on I/O errors

This commit is contained in:
John Spray
2023-10-02 14:27:46 +01:00
parent 218b514498
commit cc2c1a8bf4

View File

@@ -208,6 +208,15 @@ impl CrashsafeOverwriteError {
}
}
/// Call this when the local filesystem gives us an error with an external
/// cause: this includes EIO, EROFS, and EACCESS: all these indicate either
/// bad storage or bad configuration, and we can't fix that from inside
/// a running process.
pub(crate) fn on_fatal_io_error(e: &std::io::Error) {
tracing::error!("Fatal I/O error: {}", &e);
std::process::abort();
}
impl VirtualFile {
/// Open a file in read-only mode. Like File::open.
pub async fn open(path: &Path) -> Result<VirtualFile, std::io::Error> {