Keep children of never-uploaded parents and retry quotaExceeded saves - #548
Open
jalalawqati wants to merge 1 commit into
Open
jalalawqati wants to merge 1 commit into
jalalawqati wants to merge 1 commit into
Conversation
4 of 5 tasks
sdvz
added a commit
to sdvz/sqlite-data
that referenced
this pull request
Sep 29, 2026
…eeco#548) Backported to 1.6.0 from pointfreeco#548, which fixes pointfreeco#547. When a parent record's save is dropped (quotaExceeded, and any other error handleSentRecordZoneChanges swallows with `continue`), a child sent later is rejected with referenceViolation. The handler read that as "the parent was deleted remotely" and applied the FK's ON DELETE CASCADE, destroying the child row locally. This skips the destructive branch when the parent has no lastKnownServerRecord — i.e. it was never on the server, so nothing was deleted — and re-enqueues parent and child instead. Also moves quotaExceeded into the retry branch. Source hunks only; the PR's mock and test changes are omitted. Remove this fork once pointfreeco#548 merges and ships upstream; upgrade straight to that release rather than rebasing this patch.
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.
Description
Fixes #547
When a user's iCloud storage is full, a parent table save fails with
quotaExceededand is dropped. When one of the parent's child tables is sent later, it this time fails withreferenceViolation(rather thanquotaExceeded), andSyncEngineapplies the parent'sON DELETEaction, causing the child table to be deleted.We couldn't find a clean fix to get around this in our app unfortunately. Happy to know your suggestions.
We tested the changes in this branch with our app on a device with full iCloud storage and the issue was no longer reproducible