Skip to content

Commit e6c92ba

Browse files
committed
backend: add next record lsn to interpreted batch
1 parent 9fe5b8c commit e6c92ba

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

postgres-protocol/src/message/backend.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,9 +375,15 @@ impl ReplicationMessage<Bytes> {
375375
INTERPRETED_WAL_RECORD_TAG => {
376376
let streaming_lsn = buf.read_u64::<BigEndian>()?;
377377
let wal_end = buf.read_u64::<BigEndian>()?;
378+
let next_record_lsn = match buf.read_u64::<BigEndian>()? {
379+
0 => None,
380+
lsn => Some(lsn),
381+
};
382+
378383
ReplicationMessage::RawInterpretedWalRecords(RawInterpretedWalRecordsBody {
379384
streaming_lsn,
380385
wal_end,
386+
next_record_lsn,
381387
data: buf.read_all(),
382388
})
383389
}
@@ -965,6 +971,7 @@ impl<D> XLogDataBody<D> {
965971
pub struct RawInterpretedWalRecordsBody<D> {
966972
streaming_lsn: u64,
967973
wal_end: u64,
974+
next_record_lsn: Option<u64>,
968975
data: D,
969976
}
970977

@@ -979,6 +986,11 @@ impl<D> RawInterpretedWalRecordsBody<D> {
979986
self.wal_end
980987
}
981988

989+
#[inline]
990+
pub fn next_record_lsn(&self) -> Option<u64> {
991+
self.next_record_lsn
992+
}
993+
982994
#[inline]
983995
pub fn data(&self) -> &D {
984996
&self.data

0 commit comments

Comments
 (0)