fix(seed): drop duplicate keys instead of failing the whole batch #24
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority/Critical
Priority/High
Priority/Low
Priority/Medium
Reviewed/Confirmed
Reviewed/Duplicate
Reviewed/Invalid
Reviewed/Won't Fix
Status/Abandoned
Status/Blocked
Status/Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
project-halkyon/halkyon-curator!24
Loading…
Reference in a new issue
No description provided.
Delete branch "refs/pull/24/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Rows are keyed
(id, language)and ids derive from(language, query, entry index), so a corpus holding one query on twolines produces two rows with the same key. Postgres rejects an ON
CONFLICT command that would touch the same row twice (SQLSTATE 21000),
and it fails the entire batch, not just the repeat — one duplicated
page 500s a thousand good rows with it.
That is not hypothetical: seeding English died at 13,000 rows because a
crawl restart had re-fetched 28 pages, appending a second line for each.
The repeats were identical but for
fetchedAt, which no row fieldderives from, so keeping the first loses nothing.
Note the failure was also silent to the caller — these CLIs
return 70from
Future<int> main(), which Dart ignores, so the run still exited0. Left alone here as it is a repo-wide pattern, but scripted seeding
cannot trust the exit code; grep the log for "Upsert failed".
Signed-off-by: Tizian 「ティツィアーン」 raisondetredev@pm.me