pageserver: enable virtual_file_io_mode=direct in CI by default

Signed-off-by: Yuchen Liang <yuchen@neon.tech>
This commit is contained in:
Yuchen Liang
2024-11-11 16:24:14 +00:00
parent 54a1676680
commit 17bf707bdf
14 changed files with 103 additions and 46 deletions

View File

@@ -106,7 +106,7 @@ pub struct ConfigToml {
pub timeline_offloading: bool,
pub ephemeral_bytes_per_memory_kb: usize,
pub l0_flush: Option<crate::models::L0FlushConfig>,
pub virtual_file_io_mode: Option<crate::models::virtual_file::IoMode>,
pub virtual_file_io_mode: Option<crate::models::virtual_file::IoModeKind>,
#[serde(skip_serializing_if = "Option::is_none")]
pub no_sync: Option<bool>,
}

View File

@@ -974,35 +974,16 @@ pub mod virtual_file {
serde_with::DeserializeFromStr,
serde_with::SerializeDisplay,
Debug,
Default,
)]
#[strum(serialize_all = "kebab-case")]
#[repr(u8)]
pub enum IoMode {
pub enum IoModeKind {
/// Uses buffered IO.
#[default]
Buffered,
/// Uses direct IO, error out if the operation fails.
#[cfg(target_os = "linux")]
Direct,
}
impl IoMode {
pub const fn preferred() -> Self {
Self::Buffered
}
}
impl TryFrom<u8> for IoMode {
type Error = u8;
fn try_from(value: u8) -> Result<Self, Self::Error> {
Ok(match value {
v if v == (IoMode::Buffered as u8) => IoMode::Buffered,
#[cfg(target_os = "linux")]
v if v == (IoMode::Direct as u8) => IoMode::Direct,
x => return Err(x),
})
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]