1
Fork 0

Address comments

This commit is contained in:
John Kåre Alsaker 2025-03-21 08:09:42 +01:00
parent 157008d711
commit 34244c1477
5 changed files with 33 additions and 21 deletions

View file

@ -588,7 +588,12 @@ pub fn print_query_stack<Qcx: QueryContext>(
// state if it was responsible for triggering the panic.
let mut count_printed = 0;
let mut count_total = 0;
let query_map = qcx.collect_active_jobs().0;
// Make use of a partial query map if we fail to take locks collecting active queries.
let query_map = match qcx.collect_active_jobs() {
Ok(query_map) => query_map,
Err(query_map) => query_map,
};
if let Some(ref mut file) = file {
let _ = writeln!(file, "\n\nquery stack during panic:");

View file

@ -86,7 +86,7 @@ pub trait QueryContext: HasDepContext {
/// Get the query information from the TLS context.
fn current_query_job(self) -> Option<QueryJobId>;
fn collect_active_jobs(self) -> (QueryMap, bool);
fn collect_active_jobs(self) -> Result<QueryMap, QueryMap>;
/// Load a side effect associated to the node in the previous session.
fn load_side_effect(

View file

@ -250,10 +250,9 @@ where
Q: QueryConfig<Qcx>,
Qcx: QueryContext,
{
let (query_map, complete) = qcx.collect_active_jobs();
// Ensure there was no errors collecting all active jobs.
// We need the complete map to ensure we find a cycle to break.
assert!(complete, "failed to collect active queries");
let query_map = qcx.collect_active_jobs().expect("failed to collect active queries");
let error = try_execute.find_cycle_in_stack(query_map, &qcx.current_query_job(), span);
(mk_cycle(query, qcx, error), None)