[ 
https://issues.apache.org/jira/browse/LUCENE-1516?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jason Rutherglen updated LUCENE-1516:
-------------------------------------

    Attachment: LUCENE-1516.patch

Some terminology for this patch, an internal reader is the
IndexWriter's reader. An external reader given via the
IW.reopenReader method. 

If DirectoryIndexReader has a writer, no lock is acquired on updates.
IR.clone normally passes the writeLock to the new reader, however the
external IR and the IW internal IR both need to hold the write lock.
For this reason the user must be careful when flushing to insure the
proper instance of the IR's deletes are merged with the writer. 

The external IR.flush does not flush the deletes to disk, instead it
merges with the IW's internal IR which is in RAM. IW.flush causes
deletes and new segments to be flushed to the directory.

The test cases from TestIndexWriterReader testIndexWriterDeletes and
testIndexWriterReopenSegment fail when the IW is opened again after
commit and close. The index files are being deleted during IW.commit.
I traced this to IW.finishCommit -> deleter.checkpoint ->
deleter.deletePendingFiles. 





> Integrate IndexReader with IndexWriter 
> ---------------------------------------
>
>                 Key: LUCENE-1516
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1516
>             Project: Lucene - Java
>          Issue Type: Improvement
>    Affects Versions: 2.4
>            Reporter: Jason Rutherglen
>            Priority: Minor
>             Fix For: 2.9
>
>         Attachments: LUCENE-1516.patch, LUCENE-1516.patch, LUCENE-1516.patch
>
>   Original Estimate: 672h
>  Remaining Estimate: 672h
>
> The current problem is an IndexReader and IndexWriter cannot be open
> at the same time and perform updates as they both require a write
> lock to the index. While methods such as IW.deleteDocuments enables
> deleting from IW, methods such as IR.deleteDocument(int doc) and
> norms updating are not available from IW. This limits the
> capabilities of performing updates to the index dynamically or in
> realtime without closing the IW and opening an IR, deleting or
> updating norms, flushing, then opening the IW again, a process which
> can be detrimental to realtime updates. 
> This patch will expose an IndexWriter.getReader method that returns
> the currently flushed state of the index as a class that implements
> IndexReader. The new IR implementation will differ from existing IR
> implementations such as MultiSegmentReader in that flushing will
> synchronize updates with IW in part by sharing the write lock. All
> methods of IR will be usable including reopen and clone. 

-- 
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: java-dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-dev-h...@lucene.apache.org

Reply via email to