lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shai Erera <ser...@gmail.com>
Subject Re: ReadOnly IndexReaders
Date Thu, 04 Jun 2009 15:43:22 GMT
So for this scenario I guess I would have like to know the reader is
read-only. But if I understand you correctly, you say that writing my app
such that one method get a reader for doing some job on non-deleted
documents, while another get the same reader and might delete stuff is a bad
design anyway.

isReadOnly() would not help me as it will be false (since by design that
same reader instance is used for read/write by another method), and calling
hasDeletions and isDeleted is probably buggy in that application anyway.

So I should make sure my app instantiates a one reader for the
read-only-expecting method, and another for the read/write-expecting method.

Just clarifying my understanding out loud.

Shai

On Thu, Jun 4, 2009 at 5:25 PM, Yonik Seeley <yonik@lucidimagination.com>wrote:

> On Thu, Jun 4, 2009 at 10:19 AM, Mark Miller <markrmiller@gmail.com>
> wrote:
> > If you use hasDeletions() with a non read-only
> > Reader, then someone could delete out from under you, right?
>
> Right... but calling isDeleted() doesn't fix that (because of race
> conditions).  You could call isDeleted(5) which would return false,
> then asynchronously another thread could call deleteDocument(5) before
> you get a chance to do something with that doc (and you get
> exceptions, etc.)
>
> -Yonik
> http://www.lucidimagination.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>

Mime
View raw message