Re: Checking integrity of a Core Data document with SQLite store

2010-03-17 Thread Ben Trumbull
The integrity check will do that, but there's no way to mitigate the I/O costs. Conceptually, if you added a simple checksum, you'd still have to read the entire file to verify it matched the checksum. This file corruption should be extremely rare, and should only occur after power loss or ker

Re: Checking integrity of a Core Data document with SQLite store

2010-03-17 Thread Dave Fernandes
Thanks, Ben and mmalc for the responses. I found that prefetching the commonly accessed objects in my document's initWithContentsOfURL:ofType:error method finds the corruption pretty reliably. Hopefully, this is a reasonably robust check without being as i/o intensive as an integrity check. It

Re: Checking integrity of a Core Data document with SQLite store

2010-03-15 Thread Dave Fernandes
Yes, the exception occurs when the UI attempts to fault in an object for display. (The display code coalesces updates, which is why the stack trace starts with __NSFireDelayedPerform ). On 2010-03-15, at 11:03 PM, Ben Trumbull wrote: > > You should generally get an NSError with the code that i

Re: Checking integrity of a Core Data document with SQLite store

2010-03-15 Thread Ben Trumbull
On Mar 15, 2010, at 7:49 PM, Dave Fernandes wrote: > > On 2010-03-15, at 3:30 PM, Ben Trumbull wrote: > >> Running an integrity check can be useful if you have previously gotten a >> corrupt db error back from fetching or saving, or your app previously >> crashed, or you have some other activ

Re: Checking integrity of a Core Data document with SQLite store

2010-03-15 Thread Dave Fernandes
On 2010-03-15, at 3:30 PM, Ben Trumbull wrote: > Running an integrity check can be useful if you have previously gotten a > corrupt db error back from fetching or saving, or your app previously > crashed, or you have some other active indicator it might be worthwhile. > However, it's quiet ex

Re: Checking integrity of a Core Data document with SQLite store

2010-03-15 Thread Ben Trumbull
> On 14 Mar 2010, at 9:47 PM, mmalc Crawford wrote: > >> On Mar 14, 2010, at 7:21 pm, Dave Fernandes wrote: >> >>> So my question is - how do you detect this before loading the file? I'm >>> aware of the sqlite3 PRAGMA integrity_check, but there does not seem to be >>> a C API for this. Any poi

Re: Checking integrity of a Core Data document with SQLite store

2010-03-15 Thread Fritz Anderson
On 14 Mar 2010, at 9:47 PM, mmalc Crawford wrote: > On Mar 14, 2010, at 7:21 pm, Dave Fernandes wrote: > >> So my question is - how do you detect this before loading the file? I'm >> aware of the sqlite3 PRAGMA integrity_check, but there does not seem to be a >> C API for this. Any pointers? >>

Re: Checking integrity of a Core Data document with SQLite store

2010-03-14 Thread mmalc Crawford
On Mar 14, 2010, at 7:21 pm, Dave Fernandes wrote: > So my question is - how do you detect this before loading the file? I'm aware > of the sqlite3 PRAGMA integrity_check, but there does not seem to be a C API > for this. Any pointers? >