Skip to main content

advance_slot

Function advance_slot 

Source
pub async fn advance_slot(
    connection_url: &str,
    slot_name: &str,
    lsn: u64,
) -> Result<(), FaucetError>
Expand description

Advance the slot’s confirmed_flush_lsn to lsn via a control-plane SQL call (pg_replication_slot_advance), before the replication stream is opened.

This is how the connector resumes past already-consumed, durably-persisted changes without ever advancing the slot ahead of durability (#78/#1). For a logical slot, START_REPLICATION resumes decoding from the slot’s confirmed_flush_lsn — the client-supplied start LSN does not filter transactions that committed below it — so the only way to skip consumed changes is to move confirmed_flush_lsn forward here, while the slot is inactive. pg_replication_slot_advance never moves a slot backwards or past the server’s insert pointer, so a stale or zero lsn is a safe no-op.

The slot must be inactive, which it is between ensure_slot and start_replication.