Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Lucene: Java-Dev

IndexReader.isDeleted synchronization

 

 

Lucene java-dev RSS feed   Index | Next | Previous | View Threaded


jason.rutherglen at gmail

Jul 2, 2008, 5:54 PM

Post #1 of 4 (243 views)
Permalink
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.


lucene at mikemccandless

Jul 3, 2008, 4:55 AM

Post #2 of 4 (221 views)
Permalink
Re: IndexReader.isDeleted synchronization [In reply to]

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[at]lucene.apache.org
For additional commands, e-mail: java-dev-help[at]lucene.apache.org


jason.rutherglen at gmail

Jul 3, 2008, 5:05 AM

Post #3 of 4 (220 views)
Permalink
Re: IndexReader.isDeleted synchronization [In reply to]

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[at]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[at]lucene.apache.org
> For additional commands, e-mail: java-dev-help[at]lucene.apache.org
>
>


lucene at mikemccandless

Jul 3, 2008, 5:11 AM

Post #4 of 4 (220 views)
Permalink
Re: IndexReader.isDeleted synchronization [In reply to]

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[at]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[at]lucene.apache.org
> For additional commands, e-mail: java-dev-help[at]lucene.apache.org
>
>


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

Lucene java-dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.