Function get_min_lsns

Source
pub async fn get_min_lsns(
    client: &mut Client,
    capture_instances: impl IntoIterator<Item = &str>,
) -> Result<BTreeMap<Arc<str>, Lsn>, SqlServerError>
Expand description

Retrieves the minumum Lsn (start_lsn field) from cdc.change_tables for the specified capture instances.

This is based on the sys.fn_cdc_get_min_lsn implementation, which has logic that we want to bypass. Specifically, sys.fn_cdc_get_min_lsn returns NULL if the start_lsn in cdc.change_tables is less than or equal to the LSN returned by sys.fn_cdc_get_max_lsn.

See: https://learn.microsoft.com/en-us/sql/relational-databases/system-tables/cdc-change-tables-transact-sql?view=sql-server-ver16