[
https://issues.apache.org/jira/browse/LUCENE-1314?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Michael McCandless updated LUCENE-1314:
---------------------------------------
Attachment: LUCENE-1314.patch
New patch attached. All tests pass. Changes:
* Simplified semantics: if you clone non-readOnly reader1 to
non-readOnly reader2, I now simply clear hasChanges & writeLock on
reader1 and transfer them to reader2, but do not set readOnly in
reader1. This means reader1 is free to attempt to acquire the
write lock if it wants, and it simply fails if it's stale (ie, we
just re-use the existing code path to catch this, rather than add
a new check), and this way we never have a case where an existing
reader "becomes" readOnly -- it can only be born readOnly.
* Added reopen(readOnly) (what Jason referred to above). I think
the semantics are well defined: it returns a new reader if either
the index has changed or readOnly is different.
* Added test for "clone readOnly to non-readOnly" case, which
failed, and fixed various places where we were not respecting
"openReadOnly" correctly.
* Share common source (ReadOnlySegmentReader.noWrite) for throwing
exception on attempting change to a readOnly reader
* Fixed a sneaky pre-existing bug with reopen (added test case): if
you have a non-readOnly reader on a single segment index, then add
a segment, then reopen it and try to do a delete w/ new reader, it
fails. This is because we were incorrectly sharing the original
SegmentReader instance which still had its own SegmentInfos, so it
attempts to double-acquire write lock during a single deleteDocument
call.
* More tests
> IndexReader.clone
> -----------------
>
> Key: LUCENE-1314
> URL: https://issues.apache.org/jira/browse/LUCENE-1314
> Project: Lucene - Java
> Issue Type: New Feature
> Components: Index
> Affects Versions: 2.3.1
> Reporter: Jason Rutherglen
> Assignee: Michael McCandless
> Priority: Minor
> Fix For: 2.9
>
> Attachments: LUCENE-1314.patch, LUCENE-1314.patch, LUCENE-1314.patch,
> LUCENE-1314.patch, LUCENE-1314.patch, LUCENE-1314.patch, LUCENE-1314.patch,
> LUCENE-1314.patch, LUCENE-1314.patch, LUCENE-1314.patch, LUCENE-1314.patch,
> LUCENE-1314.patch, LUCENE-1314.patch, LUCENE-1314.patch, LUCENE-1314.patch,
> LUCENE-1314.patch, LUCENE-1314.patch, LUCENE-1314.patch, lucene-1314.patch,
> lucene-1314.patch, lucene-1314.patch, lucene-1314.patch, lucene-1314.patch,
> lucene-1314.patch, lucene-1314.patch, lucene-1314.patch, lucene-1314.patch,
> lucene-1314.patch, lucene-1314.patch, lucene-1314.patch
>
>
> Based on discussion
> http://www.nabble.com/IndexReader.reopen-issue-td18070256.html. 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 behavior.
--
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: [email protected]
For additional commands, e-mail: [email protected]