From 3296b7d77044920e57a55c43dcd8e39324613c97 Mon Sep 17 00:00:00 2001 From: Eric Seppanen Date: Tue, 18 May 2021 16:43:27 -0700 Subject: [PATCH] wal_service: permit I/O errors while reading control file I'm not sure why ignoring this error is a good idea, but the test_embedded_wal_proposer test fails if we propagate the error upward. --- walkeeper/src/wal_service.rs | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/walkeeper/src/wal_service.rs b/walkeeper/src/wal_service.rs index c110a85192..02f7702b2c 100644 --- a/walkeeper/src/wal_service.rs +++ b/walkeeper/src/wal_service.rs @@ -189,19 +189,24 @@ impl SharedState { self.control_file = Some(file); let cfile_ref = self.control_file.as_mut().unwrap(); - let my_info = SafeKeeperInfo::des_from(cfile_ref)?; - - if my_info.magic != SK_MAGIC { - bail!("Invalid control file magic: {}", my_info.magic); + match SafeKeeperInfo::des_from(cfile_ref) { + Err(e) => { + warn!("read from {:?} failed: {}", control_file_path, e); + } + Ok(info) => { + if info.magic != SK_MAGIC { + bail!("Invalid control file magic: {}", info.magic); + } + if info.format_version != SK_FORMAT_VERSION { + bail!( + "Incompatible format version: {} vs. {}", + info.format_version, + SK_FORMAT_VERSION + ); + } + self.info = info; + } } - if my_info.format_version != SK_FORMAT_VERSION { - bail!( - "Incompatible format version: {} vs. {}", - my_info.format_version, - SK_FORMAT_VERSION - ); - } - self.info = my_info; } Err(e) => { panic!(