You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Varun Thacker (JIRA)" <ji...@apache.org> on 2017/12/04 03:28:00 UTC

[jira] [Commented] (SOLR-11687) SolrCore.getNewIndexDir falsely returns {dataDir}/index on any IOException reading index.properties

    [ https://issues.apache.org/jira/browse/SOLR-11687?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16276248#comment-16276248 ] 

Varun Thacker commented on SOLR-11687:
--------------------------------------

Hi Erick,

This is my current reading of the {{getNewIndexDir()}} method ( without the patch )
1. If index.properties is not present return {{dataDir + "index/"}} 
2. If index.properties is present AND "index" key is not null/empty then return that value
3. If while reading index.properties there is an exception we return {{dataDir + "index/"}} 

From what I understood of the patch the semantics of handling point 3 have changed i.e we throw an exception instead of returning {{dataDir + "index/"}}  . Am I understanding it correctly ?

> 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
>         Attachments: SOLR-11687.patch, SOLR-11687.patch
>
>
> 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: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org