lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Rutherglen (JIRA)" <>
Subject [jira] Commented: (LUCENE-1314) IndexReader.reopen(boolean force)
Date Thu, 03 Jul 2008 18:05:45 GMT


Jason Rutherglen commented on LUCENE-1314:

There are really only two options here and perhaps this API will work.  

// true makes a copy of the data structure always, while false passes the reference if the
data structure is read only or makes a copy if it is writeable. 
IndexReader.getCopy(boolean normsWriteable, boolean deletesWriteable)
IndexReader.getCopyReadOnly() // defaults to getCopy(false, false)

Clone can be removed or default to getCopy(true, true).  The current APIs default to getCopy(true,
true).  It is good to make this explicit here so that the deletedDocs or norms cannot be changed
later when it is the clear intention of the code.  It is no different than RandomAccessFile(file,
"r") and RandomAccessFile(file, "rw")  

Lucene is supposed to be designed for fast reads at the expense of writes, no?  This code
in SegmentReader with the deletedDocs and norms synchronization goes against that.  I think
it is important to figure out a solution to give users the option of removing synchronization
in SegmentReader, users who are willing to give up a little bit in memory (norms or deletedDocs
don't use very much anyways).  

> copy-on-write approach

Is the problem with isDeleted now.  The java.util.concurrent.CopyOnWriteArrayList for example
uses a volatile list and synchronized update methods.  Which will not work because of JDK1.4.

> driver for checking on commit 

Yes, it is more of an assertion, it can be performed in Ocean as well.  

> IndexReader.reopen(boolean force)
> ---------------------------------
>                 Key: LUCENE-1314
>                 URL:
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Index
>    Affects Versions: 2.3.1
>            Reporter: Jason Rutherglen
>            Assignee: Michael McCandless
>            Priority: Minor
>         Attachments: lucene-1314.patch, lucene-1314.patch, lucene-1314.patch, lucene-1314.patch,
lucene-1314.patch, lucene-1314.patch
> Based on discussion 
The problem is reopen returns the same reader if there are no changes, so if docs are deleted
from the new reader, they are also reflected in the previous reader which is not always desired

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message