Solr
  1. Solr
  2. SOLR-1577

undesirable dataDir default in example config

    Details

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

      Description

      dataDir in the example solrconfig.xml defaults to ./solr/data (as opposed to the solr home)
      http://search.lucidimagination.com/search/document/7759f05f576d6727
      http://search.lucidimagination.com/search/document/c5ae6fa490d0f59a

      1. SOLR-1577.patch
        2 kB
        Yonik Seeley

        Activity

        Hide
        Yonik Seeley added a comment -

        Does anyone remember a reason why we haven't changed this?
        Seems like the right fix is to simply comment out dataDir to get the correct default?

        To reproduce the undesirable behavior:

        cd example
        mv solr s2
        java -Dsolr.solr.home=s2 -jar start.jar
        #observe that solr/data is created and used as the data dir
        
        Show
        Yonik Seeley added a comment - Does anyone remember a reason why we haven't changed this? Seems like the right fix is to simply comment out dataDir to get the correct default? To reproduce the undesirable behavior: cd example mv solr s2 java -Dsolr.solr.home=s2 -jar start.jar #observe that solr/data is created and used as the data dir
        Hide
        Hoss Man added a comment -

        I don't have the code/configs in front of me, but if i remember correctly it was a collision/comprimise between...

        1. the default if there is no <dataDir> is to use "data' in the instance dir
        2. that the legacy behavior of <dataDir> was to be resolve the path relative the working directory (not the instance dir)
        3. that people wanted to be able to use a solr.data.dir property with the example configs to pick an arbitrary data dir at run time for demoing stuff.

        ...if we comment out <dataDir> then #3 stops working. and because of #2 it's impossible to have a default for the solr.data.dir property in the example configs which matches the same behavior as having no dataDir at all.

        we might just want to bite the bullet and say that in the next version of solr, dataDir will be relative the instance dir, and if you don't like it add some new 'rel="cwd"' attribute to the <dataDir> tag. (or add a new default system param for absolute path of the current working directory and tell people they have to use that if they want the rest of hte value to be relative that directory)

        Show
        Hoss Man added a comment - I don't have the code/configs in front of me, but if i remember correctly it was a collision/comprimise between... 1. the default if there is no <dataDir> is to use "data' in the instance dir 2. that the legacy behavior of <dataDir> was to be resolve the path relative the working directory (not the instance dir) 3. that people wanted to be able to use a solr.data.dir property with the example configs to pick an arbitrary data dir at run time for demoing stuff. ...if we comment out <dataDir> then #3 stops working. and because of #2 it's impossible to have a default for the solr.data.dir property in the example configs which matches the same behavior as having no dataDir at all. we might just want to bite the bullet and say that in the next version of solr, dataDir will be relative the instance dir, and if you don't like it add some new 'rel="cwd"' attribute to the <dataDir> tag. (or add a new default system param for absolute path of the current working directory and tell people they have to use that if they want the rest of hte value to be relative that directory)
        Hide
        Yonik Seeley added a comment -

        2. that the legacy behavior of <dataDir> was to be resolve the path relative the working directory (not the instance dir)

        I always really expected that if you switch the instance dir, you switch the data dir by default... that's what happens by default if there is no dataDir specified in solrconfig.xml

        3. that people wanted to be able to use a solr.data.dir property with the example configs to pick an arbitrary data dir at run time for demoing stuff.

        Unfortunately, there's no way of specifying a path relativer to the instance dir.
        What if we at least made it such that an empty dataDir meant ./solr/data relative to the instance dir?

        Then we could change
        <dataDir>$

        {solr.data.dir:./solr/data}</dataDir>
        To
        <dataDir>${solr.data.dir}

        </dataDir>

        Show
        Yonik Seeley added a comment - 2. that the legacy behavior of <dataDir> was to be resolve the path relative the working directory (not the instance dir) I always really expected that if you switch the instance dir, you switch the data dir by default... that's what happens by default if there is no dataDir specified in solrconfig.xml 3. that people wanted to be able to use a solr.data.dir property with the example configs to pick an arbitrary data dir at run time for demoing stuff. Unfortunately, there's no way of specifying a path relativer to the instance dir. What if we at least made it such that an empty dataDir meant ./solr/data relative to the instance dir? Then we could change <dataDir>$ {solr.data.dir:./solr/data}</dataDir> To <dataDir>${solr.data.dir} </dataDir>
        Hide
        Yonik Seeley added a comment -

        Here's a patch that still allows solr.data.dir to be used in <dataDir> but interprets a zero length dataDir as null - resulting in the default.

        Show
        Yonik Seeley added a comment - Here's a patch that still allows solr.data.dir to be used in <dataDir> but interprets a zero length dataDir as null - resulting in the default.
        Hide
        Yonik Seeley added a comment -

        committed.

        Show
        Yonik Seeley added a comment - committed.
        Hide
        Hoss Man added a comment -

        Doesn't this break things for (hypothetical) people who have been using <dataDir></dataDir> to signify that the current working directory should be used as the data dir?

        Show
        Hoss Man added a comment - Doesn't this break things for (hypothetical) people who have been using <dataDir></dataDir> to signify that the current working directory should be used as the data dir?
        Hide
        Yonik Seeley added a comment -

        Yep. It does really seem hypothetical though - using a zero length string instead of "." to reference the current directory isn't natural. The fix seemed like the best compromise between fixing the buggy old behavior. If people are against it, we could revert and simply comment out <dataDir> in the example config - but we definitely shouldn't leave a default that doesn't follow the solr instance dir.

        Show
        Yonik Seeley added a comment - Yep. It does really seem hypothetical though - using a zero length string instead of "." to reference the current directory isn't natural. The fix seemed like the best compromise between fixing the buggy old behavior. If people are against it, we could revert and simply comment out <dataDir> in the example config - but we definitely shouldn't leave a default that doesn't follow the solr instance dir.
        Hide
        Hoss Man added a comment -

        I'm okay with it ... i'd like us to ultimately move to all patchs (not just data dir) being resolved relative the instanceDir .. but this seems like a smaller first step then anything else i had in mind.

        telling people they have to use "." if there really have some reason to use the CWD as a data dir seems fine to me.

        Show
        Hoss Man added a comment - I'm okay with it ... i'd like us to ultimately move to all patchs (not just data dir) being resolved relative the instanceDir .. but this seems like a smaller first step then anything else i had in mind. telling people they have to use "." if there really have some reason to use the CWD as a data dir seems fine to me.
        Hide
        Hoss Man added a comment -

        Correcting Fix Version based on CHANGES.txt, see this thread for more details...

        http://mail-archives.apache.org/mod_mbox/lucene-dev/201005.mbox/%3Calpine.DEB.1.10.1005251052040.24672@radix.cryptio.net%3E

        Show
        Hoss Man added a comment - Correcting Fix Version based on CHANGES.txt, see this thread for more details... http://mail-archives.apache.org/mod_mbox/lucene-dev/201005.mbox/%3Calpine.DEB.1.10.1005251052040.24672@radix.cryptio.net%3E
        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:
            Unassigned
            Reporter:
            Yonik Seeley
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development