Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-11687

SolrCore.getNewIndexDir falsely returns {dataDir}/index on any IOException reading index.properties

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 7.2, 8.0
    • None
    • None

    Description

      I'll link the originating Solr JIRA in a minute (many thanks Nikolay).

      right at the top of this method we have this:

      String result = dataDir + "index/";
      

      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:

             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);
              }
      
      

      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?

      Attachments

        1. SOLR-11687.patch
          4 kB
          Erick Erickson
        2. SOLR-11687.patch
          13 kB
          Erick Erickson
        3. SOLR-11687.patch
          14 kB
          Erick Erickson
        4. SOLR-11687_alt.patch
          0.7 kB
          Varun Thacker

        Issue Links

          Activity

            People

              erickerickson Erick Erickson
              erickerickson Erick Erickson
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: