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

AppliedSyncChangeSets.ticdsync does not save properly #55

Open
ghost opened this issue May 28, 2013 · 6 comments
Open

AppliedSyncChangeSets.ticdsync does not save properly #55

ghost opened this issue May 28, 2013 · 6 comments

Comments

@ghost
Copy link

ghost commented May 28, 2013

I am encountering a problem where TICoreDataSync is not saving the local AppliedSyncChangeSets.ticdsync file properly. This makes it so that every time the app is loaded, it re-applies all TICoreDataSync change sets, rather than only the ones which have not yet been applied.

@MrRooni
Copy link
Contributor

MrRooni commented May 29, 2013

Are you seeing any errors logged by the framework? You can turn the logging level up using

[TICDSLog setVerbosity:TICDSLogVerbosityEveryStep];

@MrRooni
Copy link
Contributor

MrRooni commented May 29, 2013

Also, be sure that your root context is being properly saved. TICDS won't consider a sync change set fully applied until the root context has persisted the applied changes to disk.

Sent from my iPad

On May 28, 2013, at 12:34 PM, jlb1234 notifications@github.com wrote:

I am encountering a problem where TICoreDataSync is not saving the local AppliedSyncChangeSets.ticdsync file properly. This makes it so that every time the app is loaded, it re-applies all TICoreDataSync change sets, rather than only the ones which have not yet been applied.


Reply to this email directly or view it on GitHub.

@ghost
Copy link
Author

ghost commented May 29, 2013

There are no errors being logged by the framework, everything appears to be working properly.

I resolved the issue by simply forcing the changes to be saved to self.appliedSyncChangesContext as opposed to self.unsavedAppliedSyncChangesContext (which seemed to be to be pointless in the first place).

@MrRooni
Copy link
Contributor

MrRooni commented May 30, 2013

The unsavedAppliedSyncChangesContext is actually part of our new sync integrity changes in 1.0.2. What happens is that TICDS will store all the applied sync changes in that context after a sync and open a SyncTransaction. It will then begin listening for ManagedObjectContextDidSave notifications for all the contexts from the background syncing context all the way up to the root context of your app that is actually doing the saving. Once it has determined that the changes TICDS applied to your object graph have been persisted to disk it moves them to the appliedSyncChangesContext.

Clearly something in that chain isn't working properly for you. I would check the TICDSDocumentSyncManager::processSyncTransactionsReadyToBeClosed method to see what it's doing as well as the internals of the TICDSSyncTransaction class. Particularly what's happening in the sync transaction when your managed object contexts save.

@ghost
Copy link
Author

ghost commented May 30, 2013

Thanks for explaining more.

What exactly was the rationale for this change? Does it provide performance enhancements? I've been working to improve the performance of the sync operations, and actually set up TICoreDataSync library to save the main core data store to disk after each individual sync change set is completed.

@MrRooni
Copy link
Contributor

MrRooni commented Jun 3, 2013

This change was actually a reliability change. What we were finding was that once TICDS applied a change it recoded it as such right away. The problem was that if something happened to the app before the app's main core data stack could save to disc (a crash, for instance) that those changes would all be lost and, since TICDS had already recorded them as applied, it never did so again.

On May 30, 2013, at 10:07 AM, jlb1234 notifications@github.com wrote:

Thanks for explaining more.

What exactly was the rationale for this change? Does it provide performance enhancements? I've been working to improve the performance of the sync operations, and actually set up TICoreDataSync library to save the main core data store to disk after each individual sync change set is completed.


Reply to this email directly or view it on GitHub.

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