From 878201843855eaee5598ed6dcb57e2a259cb7620 Mon Sep 17 00:00:00 2001 From: Konstantin Knizhnik Date: Fri, 11 Oct 2024 17:50:14 +0300 Subject: [PATCH] Add SIZE_OF_XLOG_RECORD_DATA_HEADER_SHORT --- libs/postgres_ffi/src/pg_constants.rs | 2 ++ pageserver/src/basebackup.rs | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libs/postgres_ffi/src/pg_constants.rs b/libs/postgres_ffi/src/pg_constants.rs index e343473d77..b219576f7e 100644 --- a/libs/postgres_ffi/src/pg_constants.rs +++ b/libs/postgres_ffi/src/pg_constants.rs @@ -211,6 +211,8 @@ pub const BKPBLOCK_HAS_DATA: u8 = 0x20; pub const BKPBLOCK_WILL_INIT: u8 = 0x40; /* redo will re-init the page */ pub const BKPBLOCK_SAME_REL: u8 = 0x80; /* RelFileNode omitted, same as previous */ +pub const SIZE_OF_XLOG_RECORD_DATA_HEADER_SHORT: usize = 2; + /* Information stored in bimg_info */ pub const BKPIMAGE_HAS_HOLE: u8 = 0x01; /* page image has "hole" */ diff --git a/pageserver/src/basebackup.rs b/pageserver/src/basebackup.rs index 1c29f75621..a793abe529 100644 --- a/pageserver/src/basebackup.rs +++ b/pageserver/src/basebackup.rs @@ -29,7 +29,9 @@ use crate::tenant::Timeline; use pageserver_api::reltag::{RelTag, SlruKind}; use postgres_ffi::pg_constants::{DEFAULTTABLESPACE_OID, GLOBALTABLESPACE_OID}; -use postgres_ffi::pg_constants::{PGDATA_SPECIAL_FILES, PG_HBA}; +use postgres_ffi::pg_constants::{ + PGDATA_SPECIAL_FILES, PG_HBA, SIZE_OF_XLOG_RECORD_DATA_HEADER_SHORT, +}; use postgres_ffi::relfile_utils::{INIT_FORKNUM, MAIN_FORKNUM}; use postgres_ffi::XLogFileName; use postgres_ffi::PG_TLI; @@ -264,7 +266,9 @@ where CheckPoint::decode(&checkpoint_bytes).context("deserialize checkpoint")?; let checkpoint_end_lsn = calculate_walrecord_end_lsn( Lsn(checkpoint.redo), - XLOG_SIZE_OF_XLOG_RECORD + 8 + SIZEOF_CHECKPOINT, + XLOG_SIZE_OF_XLOG_RECORD + + SIZE_OF_XLOG_RECORD_DATA_HEADER_SHORT + + SIZEOF_CHECKPOINT, ); checkpoint_end_lsn == self.lsn } else {