fix(legacy-dj-name-remediation): truncate DJ_HANDLE to 128 chars (BS#1393 hot-fix)#1399
Merged
Merged
Conversation
…1393 hot-fix) The first prod remediation run aborted at batch 5/15 with PostgresError `value too long for type character varying(128)` from `shows.legacy_dj_name`. Production has DJ_HANDLE values longer than that column's ceiling — the Cynocephalus handle (300+ chars) documented by the tubafrenzy fix in #573 is one example. The flowsheet ETL truncates at the source (jobs/flowsheet-etl/job.ts:200 + job.ts:338); the remediation script's `fetchHandleMappings` did not, so an oversized handle on a single show aborted the per-batch CTE for the whole batch. Batches 1-4 (the first ~17k shows + ~16k re-resolves) had already committed durably, so the re-run will skip them via the CTE's `IS DISTINCT FROM` filter and resume at batch 5. Truncate to the same 128-char ceiling here so the remediation matches what the ETL writes for the same row; new test pins the cap.
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.
Context
First prod run of the legacy-dj-name-remediation job (PR #1394) aborted at batch 5/15:
```
[remediate] batch 1/15: 4763 shows updated, 0 marker rows reset, 0 marker rows re-resolved.
[remediate] batch 2/15: 4756 shows updated, 0 marker rows reset, 4 marker rows re-resolved.
[remediate] batch 3/15: 4244 shows updated, 0 marker rows reset, 5763 marker rows re-resolved.
[remediate] batch 4/15: 3515 shows updated, 0 marker rows reset, 10026 marker rows re-resolved.
[remediate] Fatal error: DrizzleQueryError
cause: PostgresError: value too long for type character varying(128)
```
Production has DJ_HANDLE values longer than the `shows.legacy_dj_name varchar(128)` ceiling. The 300+ char Cynocephalus handle documented in tubafrenzy#573 is one example.
The flowsheet ETL truncates at the source (`jobs/flowsheet-etl/job.ts:200` for bulk-load and `job.ts:338` for incremental); the remediation script's `fetchHandleMappings` did not, so an oversized handle on a single show aborted the per-batch CTE for the whole batch.
Fix
Truncate to the same 128-char ceiling in `fetchHandleMappings`. Now matches what the ETL would write for the same row, so re-run idempotency between the two writers is preserved.
Resume plan
Batches 1-4 of the prior run committed durably (~17,278 shows updated, ~15,793 markers re-resolved). The CTE's `COALESCE(trim(legacy_dj_name), '') IS DISTINCT FROM` filter skips already-clean rows on re-run, so the resumed pass will start at batch 5 and finish the remaining ~55k shows + truncated handles.
Test plan