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

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        240d 23h 4m 1 Mark Miller 13/Feb/11 23:47
        Resolved Resolved Closed Closed
        44d 15h 58m 1 Grant Ingersoll 30/Mar/11 15:45
        Grant Ingersoll made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        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
        Mark Miller made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        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.
        Mark Miller made changes -
        Affects Version/s 1.4 [ 12313351 ]
        Affects Version/s 1.4.1 [ 12315096 ]
        Fix Version/s 3.1 [ 12314371 ]
        Fix Version/s 4.0 [ 12314992 ]
        Fix Version/s Next [ 12315093 ]
        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.
        Mark Miller made changes -
        Attachment SOLR-1962.patch [ 12449002 ]
        Hide
        Mark Miller added a comment -

        A patch to clean this up.

        Show
        Mark Miller added a comment - A patch to clean this up.
        Mark Miller made changes -
        Priority Major [ 3 ] Minor [ 4 ]
        Mark Miller made changes -
        Field Original Value New Value
        Description getNewIndexDir is widely used in this method - but then when a new index is created, getIndexDir is used:

        {code}
              // 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();
              }
        {code}

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

        {code}
              // 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();
              }
        {code}


        also this piece uses getIndexDir():

        {code}
              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();
                }
              }
        {code}
        Mark Miller created issue -

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development