You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Đạt Cao Mạnh <ca...@gmail.com> on 2015/07/16 11:10:19 UTC

DocumentsWriterPerThread finishDocument bug?

Hi, currently I'm reading the way Lucene index document and I found this
code and wondering that is it a bug?

DocumentsWriterPerThread.finishDocument(Term delTerm) {
  deleteQueue.add(delTerm, deleteSlice);
  // A point
  deleteSlice.apply(pendingUpdates, numDocsInRAM);
}

In the scenario when DWPT1 finish they deleteQueue.add() but not reach the
apply(). DWPT2 finish they deleteQueue.add() but not reach the apply() too.
So the deleteQueue will be in this form

<DWPT1 delTerm node> -> <DWPT2 delTerm node>

So when DWPT1 and DWPT2 apply the deleteSlice they will both insert <DWPT1
delTerm node>, <DWPT2 delTerm node> to their pendingUpdates.

-- 
*Best regards,*
*Cao Mạnh Đạt*






*D.O.B : 31-07-1991Cell: (+84) 946.328.329E-mail: caomanhdat317@gmail.com
<ca...@gmail.com>Hanoi University of Science and TechnologySchool
of information & communication technologyClass : Computer Science K54*

Re: DocumentsWriterPerThread finishDocument bug?

Posted by Michael McCandless <lu...@mikemccandless.com>.
This code is unfortunately very complex / confusing, but I *think* this is OK.

Each DeleteSlice holds what that DPWT's current delTerm is supposed to
apply to (each DWPT has its own reused DeleteSlice).

This blog post from Simon may help to get a bigger picture here:
http://blog.trifork.com/2011/05/03/lucene-indexing-gains-concurrency/

Mike McCandless

http://blog.mikemccandless.com


On Thu, Jul 16, 2015 at 5:10 AM, Đạt Cao Mạnh <ca...@gmail.com> wrote:
> Hi, currently I'm reading the way Lucene index document and I found this
> code and wondering that is it a bug?
>
> DocumentsWriterPerThread.finishDocument(Term delTerm) {
>   deleteQueue.add(delTerm, deleteSlice);
>   // A point
>   deleteSlice.apply(pendingUpdates, numDocsInRAM);
> }
>
> In the scenario when DWPT1 finish they deleteQueue.add() but not reach the
> apply(). DWPT2 finish they deleteQueue.add() but not reach the apply() too.
> So the deleteQueue will be in this form
>
> <DWPT1 delTerm node> -> <DWPT2 delTerm node>
>
> So when DWPT1 and DWPT2 apply the deleteSlice they will both insert <DWPT1
> delTerm node>, <DWPT2 delTerm node> to their pendingUpdates.
>
> --
> Best regards,
> Cao Mạnh Đạt
> D.O.B : 31-07-1991
> Cell: (+84) 946.328.329
> E-mail: caomanhdat317@gmail.com
>
> Hanoi University of Science and Technology
> School of information & communication technology
> Class : Computer Science K54

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org