[
https://issues.apache.org/jira/browse/LUCENE-4061?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13293063#comment-13293063
]
Shai Erera commented on LUCENE-4061:
------------------------------------
Believe me, I wanted to avoid it too, but ReaderManager is allocated like that
for few reasons:
* It's lazy, as the comment in the code says -- it's a waste to open an IR if
your DirTaxoWriter session is going to be short living.
** Personally, I think this is a minor issue, and if it were only that, I'd
make it final.
* The TaxoWriterCache can be 'complete' which means all the categories
currently known to DirTW are cached. In that case, it is a waste to keep the
reader open and we close it.
** This is true for Cl2oCache, since it keeps all categories in memory.
** But LruCache is not like that, since it potentially evicts entries from the
cache. So it can be 'complete' until it evicts the first entry, in which case
it will never be complete, and we'll need to keep the reader open.
Currently, when we don't need ReaderManager, we close it. We also don't open it
until few cache misses occur. To change it would mean to sacrifice efficiency
by always keeping a Reader open, even if it's not needed. It wastes RAM, file
handles and what not.
Not sure it's worth it. What do you think?
> Improvements to DirectoryTaxonomyWriter (synchronization and others)
> --------------------------------------------------------------------
>
> Key: LUCENE-4061
> URL: https://issues.apache.org/jira/browse/LUCENE-4061
> Project: Lucene - Java
> Issue Type: Improvement
> Components: modules/facet
> Reporter: Shai Erera
> Assignee: Shai Erera
> Fix For: 4.0
>
> Attachments: LUCENE-4061.patch, LUCENE-4061.patch
>
>
> DirTaxoWriter synchronizes in too many places. For instance addCategory() is
> fully synchronized, while only a small part of it needs to be.
> Additionally, getCacheMemoryUsage looks bogus - it depends on the type of the
> TaxoWriterCache. No code uses it, so I'd like to remove it -- whoever is
> interested can query the specific cache impl it has. Currently, only
> Cl2oTaxoWriterCache supports it.
> If the changes will be simple, I'll port them to 3.6.1 as well.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]