From ed487d51e71801476cd30c2f60b5f5fee137b661 Mon Sep 17 00:00:00 2001 From: Vlad Lazar Date: Wed, 20 Nov 2024 14:30:58 +0100 Subject: [PATCH] backend: pack next record LSN into the encoded message This field only needs to be read after the batch is decoded, so we can move into the body to get more efficient encoding. --- postgres-protocol/src/message/backend.rs | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/postgres-protocol/src/message/backend.rs b/postgres-protocol/src/message/backend.rs index 10dec86ca..48a601094 100644 --- a/postgres-protocol/src/message/backend.rs +++ b/postgres-protocol/src/message/backend.rs @@ -375,15 +375,10 @@ impl ReplicationMessage { INTERPRETED_WAL_RECORD_TAG => { let streaming_lsn = buf.read_u64::()?; let commit_lsn = buf.read_u64::()?; - let next_record_lsn = match buf.read_u64::()? { - 0 => None, - lsn => Some(lsn), - }; ReplicationMessage::RawInterpretedWalRecords(RawInterpretedWalRecordsBody { streaming_lsn, commit_lsn, - next_record_lsn, data: buf.read_all(), }) } @@ -971,7 +966,6 @@ impl XLogDataBody { pub struct RawInterpretedWalRecordsBody { streaming_lsn: u64, commit_lsn: u64, - next_record_lsn: Option, data: D, } @@ -986,11 +980,6 @@ impl RawInterpretedWalRecordsBody { self.commit_lsn } - #[inline] - pub fn next_record_lsn(&self) -> Option { - self.next_record_lsn - } - #[inline] pub fn data(&self) -> &D { &self.data