Terminating Sync & Data Integrity

We’re working with realm-cocoa and testing the sync client reset notification RLMSyncErrorClientResetError. To invoke the notification, we’re terminating sync on the server via Realm UI. Subsequently enabling sync on the server and waiting for the server to complete the data copy, then restarting the client results in data on the client being corrupted; specifically, objects with relationships are broken with those relationships no longer available and those linked object not completely downloading from the server.

Having tested this numerous times now, we’ve tried the following;

  • Ignore the rlmSync_clientResetBackedUpRealmPath backup realm so that the realm is not restored. The data remains corrupted.
  • Copy the objects from rlmSync_clientResetBackedUpRealmPath so that the realm is restored. This results in the process succeeding or failing, typically with RLMCreateObjectInRealmWithValue throwing an exception of No such object. The data remains corrupted.
  • Deleting the realm by calling RLMRealm deleteAllObjects. This results in only some of the objects being deleted from the server. Looking in Realm UI, the database shows numerous objects are not removed. The data remains corrupted.
  • Wiping the client and reinstall, then wait for the realm to sync. The data remains corrupted.
  • Wiping the client and reinstall, subsequently converting a functioning local realm to the same partition synced realm. This process fails after ~70% of objects copied with RLMCreateObjectInRealmWithValue throwing the same No such object exception. Note that RLMCreateObjectInRealmWithValue is called with an update policy of RLMUpdatePolicyUpdateChanged.

The only solution we’ve found is to drop the database on the server, recreate it and subsequently convert the local realm to a synced realm. This obviously is not a solution suitable for production. Can anyone shed some light on the issue ?