-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
jobs, *: use separate interface for job exec
Previously we passed PlanHookState to job execution methods like Resume or OnFailOrCancel. PlanHookState is a window into planner designed to surface its API to plannning code that exists outside the SQL package and is injected via hooks. Planning code expects to use certain methods that assume they are running during statement execution, and in particular have access to the transaction in which that statement is being executed, for example to resolve roles or privilages. Job Execution on the other hand is not done during statement execution and critically does not have a txn set. Previously the PlanHookState argument to job execution was backed by a planner as its concrete type that had a nil txn. However the API being shared with that used by planning code made it easy to accidentally call methods that assumed they were only ever called during statement planning during job execution, and thus violate the assumptions that txn could be nil or something, leading to bugs. This changes the job execution methods to expect to be passed a new type, JobExecContext, that has only the subset of methods that we expect to use during execution and, more importantly, does not have the methods exposed that should only be called during statement evaluation, and would be callable on PlanHookState. For now the implementation of JobExecContext is still backed by a planner as fields like ExtendedEvalContext are fairly closely tied to sql.planner. Later work might try to restrict this API as well. Release note: none.
- Loading branch information
Showing
26 changed files
with
206 additions
and
142 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.