Re: Core Data conflict detection
Re: Core Data conflict detection
- Subject: Re: Core Data conflict detection
- From: Miguel Arroz <email@hidden>
- Date: Wed, 21 Jul 2010 16:41:33 +0100
Hi!
On 2010/07/19, at 14:04, Paulo Andrade wrote:
> You have two threads (T1 and T2) each with their own managed object context (moc1 and moc2) which use the same persistent store coordinator.
>
> 1 - T1 reads ObjectX
> <the snapshot for ObjectX is created>
> 2 - T2 reads ObjectX
> 3 - T1 makes some changes to ObjectX
> 4 - T2 makes some other changes to ObjectX and saves
> < at this point the snapshot should be updated >
> 5 - T1 tries to save
>
>
> I'm expecting a conflict after point 5. But what does Core Data use to know this? If the snapshot is updated with the new value at step 4, the snapshot values are equal to what is on the persistent store.
That is an interesting question. I've always been "curious" about this issue in Core Data's big brother, EOF. In the situation you describe, EOF would *not* report a conflict (wrongly, in my opinion, although this has been a theme for debate in the WebObjects lists) because the snapshot would already be updated. It ends up being easier to detect conflicts between different application instances than between threads of the same instance.
Now, if Core Data also doesn't report any conflict, it means it works just like EOF. However, if it DOES report a conflict, I'm also very interested in knowing how CoreData implements this mechanism.
Regards,
Miguel Arroz_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden