Skip to main content

ensure_replication_slot

Function ensure_replication_slot 

Source
pub async fn ensure_replication_slot(
    client: &Client,
    slot_name: &str,
    plugin: &str,
) -> Result<Option<Lsn>, ConnectorError>
Expand description

Ensures the replication slot exists, creating it if necessary.

Returns the slot’s confirmed_flush_lsn if the slot already exists (useful for resuming replication from the last acknowledged position).

Uses a regular (non-replication) connection. Slot creation uses the pg_create_logical_replication_slot() SQL function which works on standard connections.

§Errors

Returns ConnectorError if the slot query or creation fails.