lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Busch (JIRA)" <>
Subject [jira] Commented: (LUCENE-743) IndexReader.reopen()
Date Mon, 08 Oct 2007 21:43:51 GMT


Michael Busch commented on LUCENE-743:

> This way if you have a reader X and you did reopen to get Y and did
> reopen again to get Z then the shared sub-readers between X, Y and Z
> would not allow any write operations until 2 of the three had been
> closed.  I think that would work?

Yes I think it would work. However, this approach has two downside IMO:
- reopen() becomes more complicated and restricted for the user. With 
the cloning approach the user doesn't have to care about when index 
modifications are not allowed. IndexReader instances returned by open()
or reopen() can be used exactly the same without any restrictions.

- We have to be very careful about cross-referencing multiple readers.
If for some reason any references between two or more readers are not
cleared after one was closed, then that reader might not become GC'd.
I'm not saying it's not possible or even very hard, we just have to 
make sure those things can't ever happen.

Of course the cloning approach has disadvantages too. For custom 
readers clone() has to be implemented in order to make reopen() work
correctly. Also reopen() is more expensive in case of 
closeOldReader=false. Well we could certainly consider the lazy clone
approach that you suggested, Mike, but we have to be careful about the
cross-referencing issue again.

So I'm really not sure which way the better one is. I think I'm slightly
in favor for the cloning approach, so that reopen() returns instances 
that are completely independant from each other, which seems cleaner IMO.
What do others think?

> IndexReader.reopen()
> --------------------
>                 Key: LUCENE-743
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>            Reporter: Otis Gospodnetic
>            Assignee: Michael Busch
>            Priority: Minor
>             Fix For: 2.3
>         Attachments:, lucene-743-take2.patch, lucene-743.patch,
lucene-743.patch, lucene-743.patch,,, varient-no-isCloneSupported.BROKEN.patch
> This is Robert Engels' implementation of IndexReader.reopen() functionality, as a set
of 3 new classes (this was easier for him to implement, but should probably be folded into
the core, if this looks good).

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