lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shai Erera <>
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.


On Thu, Jun 4, 2009 at 5:25 PM, Yonik Seeley <>wrote:

> On Thu, Jun 4, 2009 at 10:19 AM, Mark Miller <>
> 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
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message