fix: correct type mismatches in DLQ process_failed_jobs#3
Merged
Conversation
b51c175 to
9cd6ca2
Compare
Fixes two type mismatches when reading from graphile_worker's jobs table: 1. priority: Changed from i32 to i16 to match graphile_worker's smallint type 2. last_error: Changed from Option<serde_json::Value> to Option<String> to match graphile_worker's TEXT type, with conversion to JSONB for DLQ insert These mismatches caused the worker to crash with ColumnDecode errors when attempting to move failed jobs to the DLQ: - priority: 'Rust type `i32` is not compatible with SQL type `INT2`' - last_error: 'Rust type `Option<serde_json::Value>` is not compatible with SQL type `TEXT`' The graphile_worker library uses smallint (INT2/i16) for priority and TEXT for last_error, while the backfill_dlq table expects INTEGER and JSONB respectively. This fix reads the correct types from the source and converts last_error from TEXT to JSONB before inserting into DLQ.
Apply clippy suggestion to use derive macro instead of manual implementation.
88a5b5d to
8107403
Compare
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.
Fixes two type mismatches when reading from graphile_worker's jobs table:
i32toi16to match graphile_worker'ssmallinttypeOption<serde_json::Value>toOption<String>to match graphile_worker'sTEXTtype, with conversion to JSONB for DLQ insertProblem
These mismatches caused the worker to crash with ColumnDecode errors when attempting to move failed jobs to the DLQ:
Rust type 'i32' is not compatible with SQL type 'INT2'Rust type 'Option<serde_json::Value>' is not compatible with SQL type 'TEXT'Root Cause
The graphile_worker library uses
smallint(INT2/i16) for priority andTEXTfor last_error, while the backfill_dlq table expectsINTEGERandJSONBrespectively.Solution
This fix reads the correct types from the source table and converts
last_errorfrom TEXT to JSONB before inserting into DLQ.Additional Fixes
To make CI pass, this PR also includes fixes for pre-existing issues:
DefaultforQueueenum instead of manual implementationSerialize/Deserializederives and explicit type annotationsTesting
All DLQ tests pass (18/18):
test_dlq_process_failed_jobs_emptytest_dlq_process_failed_jobs_with_mock_data