Skip to main content

Module job

Module job 

Source

Structsยง

AbstractedWaiter ๐Ÿ”’
This abstracts over non-resumable waiters which are found in QueryJobโ€™s parent field and resumable waiters are in latch field.
QueryJobInfo ๐Ÿ”’
QueryJobMap
Map from query job IDs to job information collected by collect_active_query_jobs.

Functionsยง

abstracted_waiters_of ๐Ÿ”’
Returns all the non-resumable and resumable waiters of a query. This is used so we can uniformly loop over both non-resumable and resumable waiters.
break_query_cycles
Detects query cycles by using depth first search over all active query jobs. If a query cycle is found it will break the cycle by finding an edge which uses a query latch and then resuming that waiter. There may be multiple cycles involved in a deadlock, so this searches all active queries for cycles before finally resuming all the waiters at once.
connected_to_root ๐Ÿ”’
Finds out if thereโ€™s a path to the compiler root (aka. code which isnโ€™t in a query) from query without going through any of the queries in visited. This is achieved with a depth first search.
create_cycle_error ๐Ÿ”’
find_cycle ๐Ÿ”’
Looks for a query cycle by doing a depth first search starting at query. span is the reason for the query to execute. This is initially DUMMY_SP. If a cycle is detected, this initial value is replaced with the span causing the cycle. stack will contain just the cycle on return if detected.
find_cycle_in_stack ๐Ÿ”’
find_dep_kind_root ๐Ÿ”’
Finds the query job closest to the root that is for the same query method as id (but not necessarily the same query key), and returns information about it.
print_query_stack
remove_cycle ๐Ÿ”’
Looks for a query cycle using the last query in jobs. If a cycle is found, all queries in the cycle is removed from jobs and the function return true. If a cycle was not found, the starting query is removed from jobs and the function returns false.

Type Aliasesยง

ResumableWaiterLocation ๐Ÿ”’
The locaton of a resumable waiter. The usize is the index into waiters in the queryโ€™s latch. Weโ€™ll use this to remove the waiter using QueryLatch::extract_waiter if weโ€™re waking it up.