Re: Solved: refreshObject doesn't seem to work
Re: Solved: refreshObject doesn't seem to work
- Subject: Re: Solved: refreshObject doesn't seem to work
- From: Ben Trumbull <email@hidden>
- Date: Thu, 9 Oct 2008 12:40:02 -0700
On Oct 9, 2008, at 7:10 AM, Steve Steinitz wrote:
If this would be particularly useful, you should file an ER.
Based on my small knowledge of the problem, it seems it might be
worth an ER.
I invite you to have your way with bugreport.apple.com. Despite it's
name it also does enhancement requests, feature requests,
documentation requests, and performance optimization requests.
shouldn't calling refreshObject avoid the optimistic locking error
on
save?)
Not necessarily when you pass in mergeChanges:YES. A tangentially
related object might trigger the conflict.
OK, that's great information. I haven't seen optimistic locking
errors since sprinkling calls to
setRelationshipKeyPathsForPrefetching. Would that make sense?
Yes, if they are stale, and you changed related objects (like added or
removed from a to-many relationship). Or perhaps the optimistic
locking error just wasn't being generated from the objects you thought ?
Try explicitly fetching the other objects you are refreshing. If
that works, then it's worth filing a bug.
Gold. I'll test further and file a bug if all seems OK.
One thing worth mentioning: although my client uses an AFP share, it
dawned on me that I had recently changed my test rig to use an SMB
share (faster gigabit link). From what you said, that would have
introduced problems.
Eventually, yes. Detecting stale cached data can be difficult because
until it gets written back out (e.g. corrupts the database), most apps
don't notice they're showing slightly wrong/old results. A sample app
that uses both SQLite over NFS and a direct IPC channel and compares
the results of operations over each channel can fail in a couple
seconds. There is an excellent introduction to these cache coherency
issues here:
<http://article.gmane.org/gmane.comp.db.sqlite.general/35891>
Also, direct file access to the db from multiple different file
systems (e.g HFS & AFP, SMB & AFP, etc) is just broken. (Similar
issue)^2
Having multiple processes on a single machine use SQLite over NFS is
not a problem, nor having a group of machine round robin through
serialized access to the db over NFS if they close the file before
passing the baton.
That said, the addition of setRelationshipKeyPathsForPrefetching
seemed to help even the SMB setup.
Not surprising. More fetching will reduce the window of opportunity
for caching problems. I'm guessing you are mostly impacted by the
staleness interval over network FS issue.
But now, having reverted to an AFP test rig, I can NOT make it fail
at all.
Well, that's good :-)
- Ben
_______________________________________________
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