Skip to content

fix(files): name the fixes when two files of a folder hold one replace_key value - #334

Merged
kvlonge merged 2 commits into
mainfrom
files-overlap-error
Nov 18, 2026
Merged

kvlonge merged 2 commits into
mainfrom
files-overlap-error

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

When two files in a delete_insert folder hold the same replace_key value, the load stops, because each file replaces the rows of the values it holds and loading both would keep only the last one. The error said that, but the fix it gave ("remove whichever file is outdated") left users guessing which case they were in.

The error now names the fix for each case:

  • If the files are parts of one export, put all the rows of each value in one file.
  • If one file restates the other, remove the older of the two files from the folder by hand. Then set after_load = { move_to = ... } (or "delete") so that each file leaves the folder once it loads, and a file sent later replaces its values instead of meeting this error.

A failed load moves nothing, so after_load can't clear this error itself. It only prevents a repeat. Both versions of the error say so: the one raised when two files in one run overlap, and the one raised when a file overlaps rows an earlier run loaded from a file still in the folder.

The files source page explains the two cases the same way.

Verification

  • The loader test for this case (given_le_files_when_delete_insert_replaces_by_replace_key_then_each_version_holds_the_rows_of_its_newest_file) asserts both full messages. It failed on the old wording and passes now.
  • fensu check is clean.

…e_key value

The error now says what to do in each case: put a value's rows in one file
when the files are parts of one export, or, when a newer file restates an
older one, take the older file out of the folder by hand or with after_load.
…t that it clears one

A failed load moves nothing, so the older file must be removed by hand; after_load keeps a later
file from meeting it again.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying sqlload with  Cloudflare Pages  Cloudflare Pages

Latest commit: b14d692
Status: ✅  Deploy successful!
Preview URL: https://5a81e072.sqlload.pages.dev
Branch Preview URL: https://files-overlap-error.sqlload.pages.dev

View logs

@kvlonge
kvlonge merged commit be4b739 into main Nov 18, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant