INNER CODE UNIT · Rust

validate_queries

RyanCodrai/turbovec · turbovec-python/src/lib.rs:214

fn validate_queries(values: &[f32], dim: usize) -> PyResult<()> {
    if let Some((vi, ci, v)) = turbovec_core::first_invalid_coord(values, dim) {
        return Err(pyo3::exceptions::PyValueError::new_err(format!(
            "invalid query value at query {vi}, coord {ci}: {v} \
             (must be finite and |value| < 1e16)",
        )));
    }
    Ok(())
}

/// [`validate_queries`], run in the fork-safe pool when — and only when —
/// the scan actually splits (issue #288). A splitting scan on the calling
/// thread injects work into rayon's global pool, which this module pins to
/// a one-thread sentinel whose worker is dead in a forked child: the #147
/// deadlock, reachable from an ordinary `search` with >64K query floats.
///
/// The gate is the chunk threshold rather than the search's own pooling
/// predicate: a sub-chunk buffer is a single `par_chunks` item that rayon

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…