From a56bef7d9c16a11441388daee1de8854c3bb4bea Mon Sep 17 00:00:00 2001 From: John Spray Date: Sat, 20 Jul 2024 23:17:24 +0100 Subject: [PATCH] Set MAX_SEND_SIZE to 1MB --- libs/postgres_ffi/src/lib.rs | 2 +- safekeeper/src/send_wal.rs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/libs/postgres_ffi/src/lib.rs b/libs/postgres_ffi/src/lib.rs index 729f57f829..130486680b 100644 --- a/libs/postgres_ffi/src/lib.rs +++ b/libs/postgres_ffi/src/lib.rs @@ -132,7 +132,7 @@ 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 MAX_SEND_SIZE: usize = XLOG_BLCKSZ * 16; +pub const MAX_SEND_SIZE: usize = XLOG_BLCKSZ * 128; // Export some version independent functions that are used outside of this mod pub use v14::xlog_utils::encode_logical_message; diff --git a/safekeeper/src/send_wal.rs b/safekeeper/src/send_wal.rs index 90b1604adb..10963eb6d8 100644 --- a/safekeeper/src/send_wal.rs +++ b/safekeeper/src/send_wal.rs @@ -456,7 +456,7 @@ impl SafekeeperPostgresHandler { // not synchronized with sends, so this avoids deadlocks. let reader = pgb.split().context("START_REPLICATION split")?; - let mut sender = WalSender { + let mut sender = Box::new(WalSender { pgb, // should succeed since we're already holding another guard tli: tli.wal_residence_guard().await?, @@ -468,7 +468,7 @@ impl SafekeeperPostgresHandler { ws_guard: ws_guard.clone(), wal_reader, send_buf: [0; MAX_SEND_SIZE], - }; + }); let mut reply_reader = ReplyReader { reader, ws_guard: ws_guard.clone(), @@ -586,6 +586,7 @@ impl WalSender<'_, IO> { } let send_size = (chunk_end_pos.0 - self.start_pos.0) as usize; let send_buf = &mut self.send_buf[..send_size]; + let send_size: usize; { // If uncommitted part is being pulled, check that the term is