From 6ad0739080a9063a2407a6ac395eaa26354ceea1 Mon Sep 17 00:00:00 2001 From: Erik Grinaker Date: Tue, 12 Nov 2024 16:36:54 +0100 Subject: [PATCH] postgres_ffi: bump `WAL_SEGMENT_SIZE` to 128 MB --- libs/postgres_ffi/src/lib.rs | 2 +- libs/postgres_ffi/wal_craft/src/xlog_utils_test.rs | 2 +- safekeeper/src/state.rs | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/libs/postgres_ffi/src/lib.rs b/libs/postgres_ffi/src/lib.rs index 0239b56d9c..b56e99b64d 100644 --- a/libs/postgres_ffi/src/lib.rs +++ b/libs/postgres_ffi/src/lib.rs @@ -241,7 +241,7 @@ pub use v14::bindings::{CheckPoint, ControlFileData}; pub const BLCKSZ: u16 = 8192; pub const RELSEG_SIZE: u32 = 1024 * 1024 * 1024 / (BLCKSZ as u32); pub const XLOG_BLCKSZ: usize = 8192; -pub const WAL_SEGMENT_SIZE: usize = 16 * 1024 * 1024; +pub const WAL_SEGMENT_SIZE: usize = 128 * 1024 * 1024; pub const MAX_SEND_SIZE: usize = XLOG_BLCKSZ * 16; diff --git a/libs/postgres_ffi/wal_craft/src/xlog_utils_test.rs b/libs/postgres_ffi/wal_craft/src/xlog_utils_test.rs index 9eb3f0e95a..35034ef47a 100644 --- a/libs/postgres_ffi/wal_craft/src/xlog_utils_test.rs +++ b/libs/postgres_ffi/wal_craft/src/xlog_utils_test.rs @@ -151,7 +151,7 @@ fn check_end_of_wal( .unwrap(); } -const_assert!(WAL_SEGMENT_SIZE == 16 * 1024 * 1024); +const_assert!(WAL_SEGMENT_SIZE == 128 * 1024 * 1024); #[test] pub fn test_find_end_of_wal_simple() { diff --git a/safekeeper/src/state.rs b/safekeeper/src/state.rs index b8925d785e..941b7e67d0 100644 --- a/safekeeper/src/state.rs +++ b/safekeeper/src/state.rs @@ -4,6 +4,7 @@ use std::{cmp::max, ops::Deref}; use anyhow::{bail, Result}; +use postgres_ffi::WAL_SEGMENT_SIZE; use safekeeper_api::models::TimelineTermBumpResponse; use serde::{Deserialize, Serialize}; use utils::{ @@ -144,7 +145,7 @@ impl TimelinePersistentState { ServerInfo { pg_version: 170000, /* Postgres server version (major * 10000) */ system_id: 0, /* Postgres system identifier */ - wal_seg_size: 16 * 1024 * 1024, + wal_seg_size: WAL_SEGMENT_SIZE as u32, }, vec![], Lsn::INVALID,