Skip to content

Commit 9489107

Browse files
VladLazararpad-m
authored andcommitted
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.
1 parent 82124f0 commit 9489107

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

postgres-protocol/src/message/backend.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -375,15 +375,10 @@ impl ReplicationMessage<Bytes> {
375375
INTERPRETED_WAL_RECORD_TAG => {
376376
let streaming_lsn = buf.read_u64::<BigEndian>()?;
377377
let commit_lsn = buf.read_u64::<BigEndian>()?;
378-
let next_record_lsn = match buf.read_u64::<BigEndian>()? {
379-
0 => None,
380-
lsn => Some(lsn),
381-
};
382378

383379
ReplicationMessage::RawInterpretedWalRecords(RawInterpretedWalRecordsBody {
384380
streaming_lsn,
385381
commit_lsn,
386-
next_record_lsn,
387382
data: buf.read_all(),
388383
})
389384
}
@@ -977,7 +972,6 @@ impl<D> XLogDataBody<D> {
977972
pub struct RawInterpretedWalRecordsBody<D> {
978973
streaming_lsn: u64,
979974
commit_lsn: u64,
980-
next_record_lsn: Option<u64>,
981975
data: D,
982976
}
983977

@@ -992,11 +986,6 @@ impl<D> RawInterpretedWalRecordsBody<D> {
992986
self.commit_lsn
993987
}
994988

995-
#[inline]
996-
pub fn next_record_lsn(&self) -> Option<u64> {
997-
self.next_record_lsn
998-
}
999-
1000989
#[inline]
1001990
pub fn data(&self) -> &D {
1002991
&self.data

0 commit comments

Comments
 (0)