| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Arbiter.Core.Job.Schema.Groups
Description
Internal to the arbiter packages. Not covered by the PVP.
Schema for the per-queue group summary table and the statement-level triggers that maintain it. The summary carries each group's head, counts and visibility deadlines. The claim ranks groups from it.
Synopsis
- createJobQueueGroupKeyIndexSQL :: SchemaName -> TableName -> Text
- createJobQueueGroupRetriedIndexSQL :: SchemaName -> TableName -> Text
- createJobQueueGroupedDueIndexSQL :: SchemaName -> TableName -> Text
- createJobQueueGroupInFlightIndexSQL :: SchemaName -> TableName -> Text
- createGroupsTableSQL :: SchemaName -> TableName -> Text
- migrateGroupsReadyRankingSQL :: SchemaName -> TableName -> Text
- createGroupsEmptiedIndexSQL :: SchemaName -> TableName -> Text
- groupAggregates :: Text -> Text
- inFlightPredicate :: Text -> Text
- createGroupsTriggerFunctionsSQL :: SchemaName -> TableName -> Text
- createGroupsTriggersSQL :: SchemaName -> TableName -> Text
Grouped Job Indexes
createJobQueueGroupKeyIndexSQL :: SchemaName -> TableName -> TextSource #
Partial index over (group_key, priority, id), read by the claim's LATERAL
subqueries and by the maintenance triggers recomputing a group's minima.
createJobQueueGroupRetriedIndexSQL :: SchemaName -> TableName -> TextSource #
Partial index over (group_key, attempts DESC, priority, id) for retried rows,
read by the claim's group head gate. Retried rows rank ahead of the rest. The
gate merges this run with the (group_key, priority, id) scan.
createJobQueueGroupedDueIndexSQL :: SchemaName -> TableName -> TextSource #
Parked grouped jobs (scheduled, backoff or leased) by visibility deadline. Group
maintenance uses this index to replace next_due with one point lookup.
createJobQueueGroupInFlightIndexSQL :: SchemaName -> TableName -> TextSource #
Possible in-flight grouped jobs by descending lease deadline. The query applies the time-dependent part of the predicate at runtime.
Groups table SQL
createGroupsTableSQL :: SchemaName -> TableName -> TextSource #
Create a queue's groups table, one summary row per group_key carrying the group's
precomputed minima, counts and in_flight_until. Maintained by the triggers
createGroupsTriggersSQL installs.
migrateGroupsReadyRankingSQL :: SchemaName -> TableName -> TextSource #
Add ready_count and next_due to the groups summary, make the ranking
index partial on ready rows, and add the next_due due-finder.
createGroupsEmptiedIndexSQL :: SchemaName -> TableName -> TextSource #
Index over the summary rows the maintenance triggers emptied in place.
Summary column definitions
groupAggregates :: Text -> TextSource #
The group summary aggregates over job rows grouped by group_key. min_priority
and min_id rank the group. col prefixes each column.
inFlightPredicate :: Text -> TextSource #
Whether a job still holds its group's in-flight slot. col prefixes each column.
Groups trigger SQL
createGroupsTriggerFunctionsSQL :: SchemaName -> TableName -> TextSource #
Group maintenance with indexed extremum replacement. Transition tables supply count deltas. No update or delete scans all rows in an affected group.
createGroupsTriggersSQL :: SchemaName -> TableName -> TextSource #
The three statement-level AFTER triggers calling a queue's groups maintenance functions, each handed its affected rows through a transition table.