From 651a8139f5ac437c5785a974e53fb8fc81f9af4a Mon Sep 17 00:00:00 2001 From: Konstantin Knizhnik Date: Fri, 30 Apr 2021 19:24:00 +0300 Subject: [PATCH] Fix bug in transaction_id_set_status_bit --- pageserver/src/walredo.rs | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/pageserver/src/walredo.rs b/pageserver/src/walredo.rs index dbb23d6547..1648f39825 100644 --- a/pageserver/src/walredo.rs +++ b/pageserver/src/walredo.rs @@ -201,26 +201,11 @@ impl WalRedoManagerInternal { let byteno: usize = ((xid as u32 % pg_constants::CLOG_XACTS_PER_PAGE as u32) / pg_constants::CLOG_XACTS_PER_BYTE) as usize; - let byteptr = &mut page[byteno..byteno + 1]; let bshift: u8 = ((xid % pg_constants::CLOG_XACTS_PER_BYTE) * pg_constants::CLOG_BITS_PER_XACT as u32) as u8; - let mut curval = byteptr[0]; - curval = (curval >> bshift) & pg_constants::CLOG_XACT_BITMASK; - - let mut byteval = [0]; - byteval[0] = curval; - byteval[0] &= !(((1 << pg_constants::CLOG_BITS_PER_XACT as u8) - 1) << bshift); - byteval[0] |= status << bshift; - - byteptr.copy_from_slice(&byteval); - trace!( - "xid {} byteno {} curval {} byteval {}", - xid, - byteno, - curval, - byteval[0] - ); + page[byteno] = + (page[byteno] & !(pg_constants::CLOG_XACT_BITMASK << bshift)) | (status << bshift); } ///