Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit exceeded for number of owning references to single record #192

Open
sskjames opened this issue Aug 29, 2024 · 2 comments
Open

Limit exceeded for number of owning references to single record #192

sskjames opened this issue Aug 29, 2024 · 2 comments

Comments

@sskjames
Copy link
Contributor

When a record is referred by more than 750 other records, I get this error:

<CKError 0x15fccbdf0: "Partial Failure" (2/1011); "Failed to modify some records"; .....
partial errors: {
RecordTypeA.A6A0F60C-A460-4ABB-AC73-684F6BF6181B:(QSCloudKitCustomZoneName:__defaultOwner__) = <CKError 0x117adc980: "Limit Exceeded" (27/2023); server message = "Limit exceeded for number of owning references to single record";
....
... 9 "Batch Request Failed" CKErrors omitted ...
}

I could consistently recreate this problem.

Is this because of cascade delete?

There is a hard limit to the number of references with a [CKRecord.ReferenceAction.deleteSelf](https://developer.apple.com/documentation/cloudkit/ckrecord/referenceaction/deleteself) action that any one record can have. 
This limit is 750 references, and any attempt to exceed it results in an error from the server.

Ref: CKReference

Is there a way to resolve this?

@sskjames
Copy link
Contributor Author

The problem could be here in the recordToUpload method in RealmSwiftAdapter.

 // if we set the parent we must make the action .deleteSelf, otherwise we get errors if we ever try to delete the parent record
                        let action: CKRecord.ReferenceAction = parentKey == property.name ? .deleteSelf : .none
                        let recordReference = CKRecord.Reference(recordID: recordID, action: action)
                        record[property.name] = recordReference;

@sskjames
Copy link
Contributor Author

If I set the action as .none, then the problem is not happening, but then we will lose cascade delete.

sskjames added a commit to mcruncher/SyncKit that referenced this issue Aug 30, 2024
Using .deleteSelf as the action for parent referene causes sync to stop completely when the parent has 750 child records.
sskjames added a commit to mcruncher/SyncKit that referenced this issue Sep 2, 2024
…mber-of-owning-references

mentrena#192 Used .none as the reference action
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

No branches or pull requests

1 participant