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

SolrCore#getIndexDir() contract change between 3.6 and 4.1

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.0, 4.1
    • 4.2, 6.0
    • None
    • None

    Description

      In SVN 1420992, SolrCore#getIndexDir() changed it's implementation from a version that would reflect the value of the index property in index.properties to one that does not.

      In 3.6, SolrCore#getIndexDir() was:

      public String getIndexDir() {
        synchronized (searcherLock) {
          if (_searcher == null)	  	
            return dataDir + "index/";
          SolrIndexSearcher searcher = _searcher.get();
          return searcher.getIndexDir() == null ? dataDir + "index/" : searcher.getIndexDir();
      }
      

      In 3.6, SolrIndexSearcher would be passed the value of SolrCore#getNewIndexDir() – which reads index.properties – in its constructor and return it when SolrIndexSearcher#getIndexDir() was called.

      In 4.1, SolrCore#getIndexDir() is:

        public String getIndexDir() {  
          return dataDir + "index/";
        }
      

      Clients of SolrCore#getIndexDir() that were expecting the previous behavior are likely to have issues. E.g.:

      --In CoreAdminHandler#handleUnloadAction(SolrQueryRequest, SolrQueryResponse) if the deleteIndex flag is set to true, it calls core.getDirectoryFactory().remove(core.getIndexDir()). If a value other than index/ is set in index.properties, the wrong directory will be deleted.

      --In CoreAdminHandler#getIndexSize(SolrCore), the existence of SolrCore#getIndexDir() is checked before SolrCore#getNewIndexDir(). If a value other than index/ is set in index.properties, this will return the size of the wrong directory.

      Attachments

        1. SOLR-4413.patch
          5 kB
          Gregg Donovan
        2. SOLR-4413.patch
          7 kB
          Mark Miller

        Issue Links

          Activity

            People

              markrmiller@gmail.com Mark Miller
              greggny3 Gregg Donovan
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: