Repository navigation
perf(rules): run custom rules across host processes - #928
Merged
Merged
Conversation
…first Custom-rule invocations are dealt round-robin by subject across up to one host process per available core, then merged back into single-host order so findings, read sets, untracked and uncacheable rules, observed digests, and the custom-rule cache are identical to one host. Any host failure reruns the whole plan in one host so the reported error is exactly the single-host error. Rule evaluation now launches the custom hosts and native built-in rules before preparing SQL rule inputs, and computes custom rule payloads and implementation fingerprints once instead of up to three times.
The early SQL lint expanded and prepared each body with its own native call, handing the GIL back and forth with graph building thousands of times. Bodies are now expanded first and prepared in one GIL-free native call; a body the batch cannot prepare is prepared again on its own so failures surface exactly as before, in file order relative to expansion failures.
Rules that change module-level state on any host are evaluated again in one host over all of their subjects, replacing their split results, so cross-subject state such as a duplicate detector reports exactly what one host reports. The host count now honours cgroup v1 and v2 CPU quotas and is capped at eight. The first failing host writes a per-run cancellation marker. The other hosts check it between invocations, outside any Rule's guarded scope, and exit with a distinct cancelled status, and hosts that start late exit at once; no process is ever signalled. One invocation that is already running still ends or reaches its own timeout. One host then reruns the plan to report the single-host error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Cold compiles waited on one custom-rule host process: about 16 s of a ~28 s compile on a ~1,400-model project. Custom-rule setup data was computed up to three times, and the speculative lint held the GIL once per body (CHI-441 phase 2).
Changes
Verification
make test,make check-ci.