Re: Core Data with ODBC databases?
Re: Core Data with ODBC databases?
- Subject: Re: Core Data with ODBC databases?
- From: Scott Ribe <email@hidden>
- Date: Thu, 17 Oct 2013 11:00:39 -0600
On Oct 17, 2013, at 10:49 AM, Jens Alfke <email@hidden> wrote:
>
> On Oct 17, 2013, at 8:19 AM, Brad Gibbs <email@hidden> wrote:
>
>> Core Data is still a local cache being used by a single user, but instead of persisting to the local disk, it’s persisting to the Postgres server.
>
> But not directly, right? You said there was a Rails app in the middle serving up a REST API.
>
>> As for two people making changes to a record simultaneously, it would be handled in the same way a Rails web app would handle it. Rails and Postgres have been designed for this use case.
>
> It’s been a while since I used Rails, but the typical way that a database-driven app manages this is using transactions. Begin transaction, update rows, end transaction. That makes all the updates atomic.
Yes, but even that does not solve the problem of users overwriting each other's near-simultaneous updates.
> But NSIncrementalStore doesn’t have a notion of a transaction, because CoreData doesn’t care about concurrency, because it’s not multi-user. So if your Core Data app makes a bunch of changes, they’re going to be sent to the store, which is going to send them off as individual PUT/POST/DELETE requests. These can’t be handled atomically by the server; they’re independent requests. So they can be interleaved with other updates being made by other clients, causing trouble. Or one of them might fail for some reason, but then there’s no way to back out to a consistent state; more trouble.
Yep.
> I haven’t dug all the way into NSIncrementalStore yet. But the assumption you’re making is that you can take an architecture that works for a local single-user database, and transparently make it work over a worldwide network with lots of users just by [colorful metaphor ahead, not meant to be insulting!] snipping the wire labeled “SQLite” and soldering it to a wire labeled “Internet”. This is _exactly_ the kind of thing the “Fallacies Of Distributed Computing” article warns against … because those fallacies don’t apply to tightly-bound systems like CoreData+SQLite, and are often ignorable in LAN-based systems like the typical app-server+db-server setup in a data center. But on the Internet they will bite you.
Yep, lots of issues to "solve"; and none with a single best solution.
Been there, done that. Can you tell?
--
Scott Ribe
email@hidden
http://www.elevated-dev.com/
(303) 722-0567 voice
_______________________________________________
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