Repository navigation
fix(job): report a missing job schema from inside a PostgreSQL transaction - #4527
Merged
Merged
Conversation
…ction With jobsAutoCreateTables = false, $ensureJobTable() probed wheels_jobs and asked the catalog only after the probe failed. On PostgreSQL and CockroachDB a failed statement aborts the transaction, so inside one the catalog check then failed with "current transaction is aborted" instead of reporting Wheels.Job.SchemaMissing. There it now asks the catalog first. Also, before the 4.2.0 cut: - a spec that a job idle past the 30-second heartbeat-grace minimum is reclaimed when the setting is below it (the existing spec covers a job inside the minimum); - a spec, and a guide line, that an empty-string perform() return is stored as NULL, like a return of nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Peter Amiri <peter@alurium.com>
Contributor
Wheels Test Results111 585 tests 108 729 ✅ 56m 11s ⏱️ Results for commit fca97c9. |
Collaborator
Author
|
Review: head fca97c9. APPROVE (ready). One INFO on the floor spec. (b)
|
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.
Pre-4.2.0 polish for background jobs: one fix, two specs and one doc line.
Fix: a missing schema inside a PostgreSQL transaction
With
jobsAutoCreateTables = false,Job.$ensureJobTable()probedwheels_jobswithSELECT … WHERE 1=0and asked the catalog only after the probe failed.On PostgreSQL and CockroachDB, a failed statement aborts the transaction. So inside one, the catalog check then failed too: the caller saw
ERROR: current transaction is aborted, commands ignored until end of transaction blockinstead ofWheels.Job.SchemaMissing(with its pointer towheels jobs install).On those databases the catalog is now asked first.
JobSchema.hasTable()is a plain read, and the database type comes from the cachedJobSchema, so there's no extracfdbinfocall. Other databases don't abort a transaction on a failed statement and are unchanged.New spec in
JobSchemaSpec: "with jobsAutoCreateTables = false, says the schema is missing from inside a transaction too". Against the oldJob.cfcon Lucee 7 + PostgreSQL it fails with exactly that aborted-transaction error.Specs and docs
JobHeartbeatGraceSpec: "reclaims a job idle past the 30-second minimum when the setting is below it". The setting is 5, the last heartbeat was 45 s ago, and the job is reaped and requeued. The existing spec covers the other side: 15 s ago, inside the minimum, the job is left alone.JobLifecycleHooksSpec: "stores NULL when perform() returns an empty string, as for nothing".HookProbeJobgets anemptymode for it.NULL, because Oracle can't tell the two apart.Checked and already in place, so no change
$markInterruptedlogs only when a row changed: thewriteLogis guarded bylocal.changed > 0, the update'srecordCount. Seevendor/wheels/JobWorker.cfc,$markInterrupted.resultcolumn:NVARCHAR(4000):JobSchemadeclares itunicodeString.wheels jobs installmigration all emitNVARCHARon SQL Server.JobSchemaSpecasserts the type isnvarcharafter running the migration.Tests
The head includes a merge of develop (with #4526); the guide page builds, and the jobs suite passes on Lucee 7 + SQLite at the merged head (293).
Before the merge, jobs suite:
Also:
tools/rustcfml/run-suite.sh,TZ=UTC): exit 0, no new failures.verify-docson the guide page: 13/13.A changelog fragment (
fixed) covers the user-visible fix.🤖 Generated with Claude Code