Skip to content

jobs: Job scheduler should not expose txn to scheduled job implementations. #78466

@miretskiy

Description

@miretskiy

Currently, job scheduler exposes txn to job schedule implementation.
While the intent was to enable atomic schedule execution together with schedule record update,
exposing txn directly is dangerous. The implementation may use the transaction to perform wide reads, which then could result
in schedule txn being retried indefinitely, as show in #78465

In general, job scheduler should avoid locking records, should avoid using for update clause, and should not
expose low level primitives (txn) to job implementations. It should assume that job implementations are buggy, and must ensure
that an error in one of the job implementations does not destabilize the rest of the system (show jobs, show schedules, etc).

Jira issue: CRDB-14144

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-jobsC-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)T-jobs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions