On 4/16/07, El Gato <[EMAIL PROTECTED]> wrote:
> Jens Kraemer wrote:
> > On Thu, Apr 12, 2007 at 03:10:37PM -0700, Ryan King wrote:
> >> > > > > running the same tests using the 0.11.4 version, it consistently
> >> > Any chance one of you could distill this problem to a simple script. I
> >> > don't seem to be able to replicate the problem here on my brother's
> >> > mac.
> >>
> >> I don't have a script to replicate this, but I've narrowed the problem
> >> down to an issue with concurrency.
> >>
> >> Currently I'm running AAF's rebuild_index  (against ferret_server) on
> >> a model and when I try to save an item in that model from another
> >> process, I get this error.
> >
> > Yeah, that's a problem. As of now, rebuild_index is not safe for
> > concurrent operations on the same index. I plan to rework this so
> > rebuild_index will build the new index in another index directory,
> > leaving intact the original index dir where normal index operations like
> > add/update/delete work on.
> >
> > However I dont know why the same problem would not show up with earlier
> > versions of ferret.
> >
> > Jens
> >
>
>
> I'm seeing this as well with a brand new installation 0.11.4 using AAF.
> Also, should I be actively running rebuild_index?  I must have missed
> that somewhere if that's the case.  I've simply included the standard
> acts_as_ferret :fields => [...] to my models and that's really it (which
> seems to work fine).  So, this error is causing my app to throw internal
> server errors.  What can I do about this?

Rebuild index won't work with Drb servers if you're try to write to
the index from another process besides the one running
'rebuild_index'.

For now, I'd suggest hacking AAF to not automatically rebuild indexes.
I just commented out line #23 of local_index.rb (which should read
"rebuild_index").

Then, to build/rebuild my index I'm running something like:

model = MyModel

0.step(model.count, 1000){|i| model.find(:all, :limit=>1000,
:offset=>i).each{|r| r.ferret_update}; }

This should allow concurrent writes, though it will be slower than the
existing rebuld_model.

-ryan
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to