WIP: fix oldestXid and oldestMulti handling in pageserver

This commit is contained in:
anastasia
2021-05-25 17:16:14 +03:00
parent 3f89016bd7
commit f61e92b692
2 changed files with 6 additions and 2 deletions

View File

@@ -161,7 +161,7 @@ fn add_pgcontrol_file(
// TODO: When we restart master there are no active transaction and oldestXid is
// equal to nextXid if there are no prepared transactions.
// Let's ignore them for a while...
checkpoint.oldestXid = checkpoint.nextXid.value as u32;
//checkpoint.oldestXid = checkpoint.nextXid.value as u32;
pg_control.checkPointCopy = checkpoint;
let pg_control_bytes = postgres_ffi::encode_pg_control(pg_control);
let header = new_tar_header("global/pg_control", pg_control_bytes.len() as u64)?;

View File

@@ -803,6 +803,10 @@ pub fn decode_wal_record(checkpoint: &mut CheckPoint, record: Bytes) -> DecodedW
} else {
assert!(info == pg_constants::CLOG_TRUNCATE);
blk.will_drop = true;
checkpoint.oldestXid = buf.get_u32_le();
checkpoint.oldestXidDB = buf.get_u32_le();
info!("RM_CLOG_ID truncate blkno {} oldestXid {} oldestXidDB {}",
blk.blkno, checkpoint.oldestXid, checkpoint.oldestXidDB);
}
trace!("RM_CLOG_ID updates block {}", blk.blkno);
blocks.push(blk);
@@ -1121,7 +1125,7 @@ pub fn decode_wal_record(checkpoint: &mut CheckPoint, record: Bytes) -> DecodedW
};
} else if info == pg_constants::XLOG_MULTIXACT_TRUNCATE_ID {
let xlrec = XlMultiXactTruncate::decode(&mut buf);
checkpoint.oldestXid = xlrec.end_trunc_off;
checkpoint.oldestMulti = xlrec.end_trunc_off;
checkpoint.oldestMultiDB = xlrec.oldest_multi_db;
let first_off_blkno =
xlrec.start_trunc_off / pg_constants::MULTIXACT_OFFSETS_PER_PAGE as u32;