Skip to main content

sample_pk_bounds

Function sample_pk_bounds 

Source
async fn sample_pk_bounds(
    config: &RawSourceCreationConfig,
    connection_config: &Config,
    task_name: &str,
    tables: &BTreeMap<MySqlTableName, Vec<SourceOutputInfo>>,
    metrics: &MySqlSnapshotMetrics,
) -> Result<(BTreeMap<MySqlTableName, Option<PkBoundaries>>, BTreeMap<MySqlTableName, u64>), TransientError>
Expand description

For every table, read the row count (exact only for small tables) and, for a supported single-column primary key, compute the PK-range split boundaries, concurrently over at most worker_count connections. None bounds means single-worker fallback for that table. The counts are reused for both boundary discovery and the snapshot size gauge. The snapshot size gauge is a metric reporting how many rows the snapshot needs to process.