[
https://issues.apache.org/jira/browse/SOLR-11687?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16267747#comment-16267747
]
Hoss Man commented on SOLR-11687:
---------------------------------
AFAICT, this method is just blatently broken in the situation where
{{index.properties}} exists but any sort of Exception occurs while attempting
to read it, or any sort of IOException occurs when even trying to determine if
it exists (other then the FNFE and NSFE used to indicate that it does not)
A decision needs to be made as to what the semantics of this method should be
in the event of an underlying Exception reading this file (ie: return null,
throw IOException, throw SolrException, something else, etc...) and all callers
need to be updated to ensure they account for that possibility.
Until then, this method will happily lie and say "the new index dir is
{{dataDir + "index/"}}" even if there is a much more current one listed in
{{index.properties}}.
> SolrCore.getNewIndexDir falsely returns {dataDir}/index on any IOException
> reading index.properties
> ---------------------------------------------------------------------------------------------------
>
> Key: SOLR-11687
> URL: https://issues.apache.org/jira/browse/SOLR-11687
> Project: Solr
> Issue Type: Bug
> Security Level: Public(Default Security Level. Issues are Public)
> Reporter: Erick Erickson
> Assignee: Erick Erickson
>
> I'll link the originating Solr JIRA in a minute (many thanks Nikolay).
> right at the top of this method we have this:
> {code}
> String result = dataDir + "index/";
> {code}
> If, for any reason, the method doesn't complete properly, the "result" is
> still returned. Now for instance, down in SolrCore.cleanupOldIndexDirectories
> the "old" directory is dataDir/index which may point to the current index.
> This seems particularly dangerous:
> {code}
> try {
> p.load(new InputStreamReader(is, StandardCharsets.UTF_8));
> String s = p.getProperty("index");
> if (s != null && s.trim().length() > 0) {
> result = dataDir + s;
> }
> } catch (Exception e) {
> log.error("Unable to load " + IndexFetcher.INDEX_PROPERTIES, e);
> } finally {
> IOUtils.closeQuietly(is);
> }
> {code}
> Should "p.load" fail for any reason whatsoever, we'll still return
> dataDir/index.
> Anyone want to chime on on what the expectations are here before I dive in?
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]