Supprot opaque mode for log_newpages

This commit is contained in:
Konstantin Knizhnik
2024-08-01 23:12:23 +03:00
parent bd845c7587
commit 06b8f013f0
3 changed files with 6 additions and 3 deletions

View File

@@ -203,8 +203,9 @@ pub const XLR_BLOCK_ID_DATA_LONG: u8 = 254;
pub const XLR_BLOCK_ID_ORIGIN: u8 = 253;
pub const XLR_BLOCK_ID_TOPLEVEL_XID: u8 = 252;
pub const BKPBLOCK_FORK_MASK: u8 = 0x0F;
pub const _BKPBLOCK_FLAG_MASK: u8 = 0xF0;
pub const BKPBLOCK_FORK_MASK: u8 = 0x07;
pub const BKPBLOCK_FLAG_MASK: u8 = 0xF8;
pub const BKPBLOCK_OPAQUE: u8 = 0x08; /* page has no page header */
pub const BKPBLOCK_HAS_IMAGE: u8 = 0x10; /* block data is an XLogRecordBlockImage */
pub const BKPBLOCK_HAS_DATA: u8 = 0x20;
pub const BKPBLOCK_WILL_INIT: u8 = 0x40; /* redo will re-init the page */

View File

@@ -535,7 +535,7 @@ impl WalIngest {
// The page may be uninitialized. If so, we can't set the LSN because
// that would corrupt the page.
//
if !page_is_new(&image) {
if !blk.opaque && !page_is_new(&image) {
page_set_lsn(&mut image, lsn)
}
assert_eq!(image.len(), BLCKSZ as usize);

View File

@@ -129,6 +129,7 @@ pub struct DecodedBkpBlock {
pub apply_image: bool,
/* has image that should be restored */
pub will_init: bool,
pub opaque: bool,
/* record doesn't need previous page version to apply */
//char *bkp_image;
pub hole_offset: u16,
@@ -1000,6 +1001,7 @@ pub fn decode_wal_record(
blk.has_image = (fork_flags & pg_constants::BKPBLOCK_HAS_IMAGE) != 0;
blk.has_data = (fork_flags & pg_constants::BKPBLOCK_HAS_DATA) != 0;
blk.will_init = (fork_flags & pg_constants::BKPBLOCK_WILL_INIT) != 0;
blk.opaque = (fork_flags & pg_constants::BKPBLOCK_OPAQUE) != 0;
blk.data_len = buf.get_u16_le();
/* TODO cross-check that the HAS_DATA flag is set iff data_length > 0 */