You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Jason Rutherglen <ja...@gmail.com> on 2008/07/03 02:54:04 UTC

IndexReader.isDeleted synchronization

A possible solution to the IndexReader.isDeleted synchronization is to have
a delegate class that is different depending on the Java version.  For Java
1.4 the class defaults to the synchronization used now.  A Java 1.5 version
would use a volatile deletedDocs attribute.  This would provide a backwards
compatible solution and a solution for Java versions with volatile working
that can avoid the use of synchronized.

Re: IndexReader.isDeleted synchronization

Posted by Michael McCandless <lu...@mikemccandless.com>.
Let's do it as a separate patch?  The clone patch is already scaring  
me enough ;)

Maybe we can allow creation of a read-only IndexReader during open?   
Ie, a new open method that takes a "boolean readOnly".

I had been previously thinking that we'd get to a read-only  
IndexReader by slurping all write operations into IndexWriter, but, it  
seems like that migration will take quite some time....

Mike

Jason Rutherglen wrote:

> Should we do a read-only reader as part of the clone patch?  Sounds  
> very similar.  Also sounds like the delegate model will work best  
> instead of creating a SegmentReader subclass.
>
> On Thu, Jul 3, 2008 at 7:55 AM, Michael McCandless <lucene@mikemccandless.com 
> > wrote:
>
> But I think you still need to synchronize, because the first thread  
> that does a deletion needs to create the deletedDocs BitVector and  
> others need to wait while that's happening?
>
> I think [eventually] getting to a read-only reader is the best  
> approach (https://issues.apache.org/jira/browse/LUCENE-1030).
>
> Mike
>
>
> Jason Rutherglen wrote:
>
> A possible solution to the IndexReader.isDeleted synchronization is  
> to have a delegate class that is different depending on the Java  
> version.  For Java 1.4 the class defaults to the synchronization  
> used now.  A Java 1.5 version would use a volatile deletedDocs  
> attribute.  This would provide a backwards compatible solution and a  
> solution for Java versions with volatile working that can avoid the  
> use of synchronized.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>


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


Re: IndexReader.isDeleted synchronization

Posted by Jason Rutherglen <ja...@gmail.com>.
Should we do a read-only reader as part of the clone patch?  Sounds very
similar.  Also sounds like the delegate model will work best instead of
creating a SegmentReader subclass.

On Thu, Jul 3, 2008 at 7:55 AM, Michael McCandless <
lucene@mikemccandless.com> wrote:

>
> But I think you still need to synchronize, because the first thread that
> does a deletion needs to create the deletedDocs BitVector and others need to
> wait while that's happening?
>
> I think [eventually] getting to a read-only reader is the best approach (
> https://issues.apache.org/jira/browse/LUCENE-1030).
>
> Mike
>
> Jason Rutherglen wrote:
>
>  A possible solution to the IndexReader.isDeleted synchronization is to
>> have a delegate class that is different depending on the Java version.  For
>> Java 1.4 the class defaults to the synchronization used now.  A Java 1.5
>> version would use a volatile deletedDocs attribute.  This would provide a
>> backwards compatible solution and a solution for Java versions with volatile
>> working that can avoid the use of synchronized.
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>

Re: IndexReader.isDeleted synchronization

Posted by Michael McCandless <lu...@mikemccandless.com>.
But I think you still need to synchronize, because the first thread  
that does a deletion needs to create the deletedDocs BitVector and  
others need to wait while that's happening?

I think [eventually] getting to a read-only reader is the best  
approach (https://issues.apache.org/jira/browse/LUCENE-1030).

Mike

Jason Rutherglen wrote:

> A possible solution to the IndexReader.isDeleted synchronization is  
> to have a delegate class that is different depending on the Java  
> version.  For Java 1.4 the class defaults to the synchronization  
> used now.  A Java 1.5 version would use a volatile deletedDocs  
> attribute.  This would provide a backwards compatible solution and a  
> solution for Java versions with volatile working that can avoid the  
> use of synchronized.


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