From 00940fcdb57a8e99e805297b75839e7c4c7b1796 Mon Sep 17 00:00:00 2001 From: Vlad Lazar Date: Wed, 27 Nov 2024 10:38:32 +0000 Subject: [PATCH] backend: pack next record LSN into the encoded message (#33) 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 10dec86c..48a60109 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