Skip to content

Commit

Permalink
backend: add next record lsn to interpreted batch
Browse files Browse the repository at this point in the history
  • Loading branch information
VladLazar committed Nov 15, 2024
1 parent 9fe5b8c commit e6c92ba
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions postgres-protocol/src/message/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,15 @@ impl ReplicationMessage<Bytes> {
INTERPRETED_WAL_RECORD_TAG => {
let streaming_lsn = buf.read_u64::<BigEndian>()?;
let wal_end = buf.read_u64::<BigEndian>()?;
let next_record_lsn = match buf.read_u64::<BigEndian>()? {
0 => None,
lsn => Some(lsn),
};

ReplicationMessage::RawInterpretedWalRecords(RawInterpretedWalRecordsBody {
streaming_lsn,
wal_end,
next_record_lsn,
data: buf.read_all(),
})
}
Expand Down Expand Up @@ -965,6 +971,7 @@ impl<D> XLogDataBody<D> {
pub struct RawInterpretedWalRecordsBody<D> {
streaming_lsn: u64,
wal_end: u64,
next_record_lsn: Option<u64>,
data: D,
}

Expand All @@ -979,6 +986,11 @@ impl<D> RawInterpretedWalRecordsBody<D> {
self.wal_end
}

#[inline]
pub fn next_record_lsn(&self) -> Option<u64> {
self.next_record_lsn
}

#[inline]
pub fn data(&self) -> &D {
&self.data
Expand Down

0 comments on commit e6c92ba

Please sign in to comment.