Solr
  1. Solr
  2. SOLR-1962

Index directory disagreement SolrCore#initIndex

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.4, 1.4.1
    • Fix Version/s: 3.1, 4.0-ALPHA
    • Component/s: None
    • Labels:
      None

      Description

      getNewIndexDir is widely used in this method - but then when a new index is created, getIndexDir is used:

            // Create the index if it doesn't exist.
            if(!indexExists) {
              log.warn(logid+"Solr index directory '" + new File(getNewIndexDir()) + "' doesn't exist."
                      + " Creating new index...");
      
              SolrIndexWriter writer = new SolrIndexWriter("SolrCore.initIndex", getIndexDir(), getDirectoryFactory(), true, schema, solrConfig.mainIndexConfig, solrDelPolicy);
              writer.close();
            }
      

      also this piece uses getIndexDir():

            if (indexExists && firstTime && removeLocks) {
              // to remove locks, the directory must already exist... so we create it
              // if it didn't exist already...
              Directory dir = SolrIndexWriter.getDirectory(getIndexDir(), getDirectoryFactory(), solrConfig.mainIndexConfig);
              if (dir != null)  {
                if (IndexWriter.isLocked(dir)) {
                  log.warn(logid+"WARNING: Solr index directory '" + getIndexDir() + "' is locked.  Unlocking...");
                  IndexWriter.unlock(dir);
                }
                dir.close();
              }
            }
      

        Activity

        Hide
        Mark Miller added a comment -

        A patch to clean this up.

        Show
        Mark Miller added a comment - A patch to clean this up.
        Hide
        Mark Miller added a comment -

        I'm going to commit this tomorrow.

        Show
        Mark Miller added a comment - I'm going to commit this tomorrow.
        Hide
        Mark Miller added a comment -

        Hmm..looks done on 4.x but not 3.x. I'll merge back.

        Show
        Mark Miller added a comment - Hmm..looks done on 4.x but not 3.x. I'll merge back.
        Hide
        Grant Ingersoll added a comment -

        Bulk close for 3.1.0 release

        Show
        Grant Ingersoll added a comment - Bulk close for 3.1.0 release

          People

          • Assignee:
            Mark Miller
            Reporter:
            Mark Miller
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development