Solr
  1. Solr
  2. SOLR-5162

Implicit core properties are no longer available

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 4.5
    • Fix Version/s: 4.5
    • Component/s: None
    • Labels:
      None

      Description

      As noted by ~elyograg on IRC, implicit property substitution doesn't work any more in 4.5.

      1. SOLR-5162.patch
        5 kB
        Alan Woodward
      2. SOLR-5162.patch
        10 kB
        Alan Woodward

        Activity

        Alan Woodward created issue -
        Hide
        Alan Woodward added a comment -

        I managed to chop off the 'solr.' prefix of all these substitutions in SOLR-4914. The tricksy part here is that these prefixes are not present in the core.properties file, so we need to add them in/strip them out at the appropriate times.

        The only call where the 'solr.' prefix needs to be present is in the Properties object returned by CoreDescriptor.getCoreProperties(), and this method is only ever called when creating ResourceLoaders, so we should be able to safely isolate the changes here.

        Show
        Alan Woodward added a comment - I managed to chop off the 'solr.' prefix of all these substitutions in SOLR-4914 . The tricksy part here is that these prefixes are not present in the core.properties file, so we need to add them in/strip them out at the appropriate times. The only call where the 'solr.' prefix needs to be present is in the Properties object returned by CoreDescriptor.getCoreProperties(), and this method is only ever called when creating ResourceLoaders, so we should be able to safely isolate the changes here.
        Hide
        Alan Woodward added a comment -

        Quick patch, which should solve the problem. I need to think of a decent way of testing it, though - is there a reasonably non-invasive solrconfig parameter I can use here?

        Show
        Alan Woodward added a comment - Quick patch, which should solve the problem. I need to think of a decent way of testing it, though - is there a reasonably non-invasive solrconfig parameter I can use here?
        Alan Woodward made changes -
        Field Original Value New Value
        Attachment SOLR-5162.patch [ 12598298 ]
        Hide
        Alan Woodward added a comment -

        Patch with test. The test setup is a bit complicated, because the standard TestHarness setup doesn't use a CoreContainer or CoreDescriptor to set up its cores, so substitutions won't work. Which is less than ideal, but that's for another issue.

        Shawn Heisey, does this fix your setup?

        Show
        Alan Woodward added a comment - Patch with test. The test setup is a bit complicated, because the standard TestHarness setup doesn't use a CoreContainer or CoreDescriptor to set up its cores, so substitutions won't work. Which is less than ideal, but that's for another issue. Shawn Heisey , does this fix your setup?
        Alan Woodward made changes -
        Attachment SOLR-5162.patch [ 12598609 ]
        Hide
        ASF subversion and git services added a comment -

        Commit 1515032 from Alan Woodward in branch 'dev/trunk'
        [ https://svn.apache.org/r1515032 ]

        SOLR-5162: Add back core implicit properties

        Show
        ASF subversion and git services added a comment - Commit 1515032 from Alan Woodward in branch 'dev/trunk' [ https://svn.apache.org/r1515032 ] SOLR-5162 : Add back core implicit properties
        Hide
        ASF subversion and git services added a comment -

        Commit 1515034 from Alan Woodward in branch 'dev/branches/branch_4x'
        [ https://svn.apache.org/r1515034 ]

        SOLR-5162: Add back core implicit properties

        Show
        ASF subversion and git services added a comment - Commit 1515034 from Alan Woodward in branch 'dev/branches/branch_4x' [ https://svn.apache.org/r1515034 ] SOLR-5162 : Add back core implicit properties
        Hide
        ASF subversion and git services added a comment -

        Commit 1515035 from Alan Woodward in branch 'dev/trunk'
        [ https://svn.apache.org/r1515035 ]

        SOLR-5162: ...with the right license header this time

        Show
        ASF subversion and git services added a comment - Commit 1515035 from Alan Woodward in branch 'dev/trunk' [ https://svn.apache.org/r1515035 ] SOLR-5162 : ...with the right license header this time
        Hide
        ASF subversion and git services added a comment -

        Commit 1515036 from Alan Woodward in branch 'dev/branches/branch_4x'
        [ https://svn.apache.org/r1515036 ]

        SOLR-5162: ...with the right license header this time

        Show
        ASF subversion and git services added a comment - Commit 1515036 from Alan Woodward in branch 'dev/branches/branch_4x' [ https://svn.apache.org/r1515036 ] SOLR-5162 : ...with the right license header this time
        Alan Woodward made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Steve Rowe added a comment -

        Was it intentional that the "name" property disappear? See SOLR-5281

        Show
        Steve Rowe added a comment - Was it intentional that the "name" property disappear? See SOLR-5281
        Hide
        Steve Rowe added a comment -

        Was it intentional that the "name" property disappear? See SOLR-5281

        Answering my own question: Yes:

        CoreDescriptor.java line #213
          /**
           * Create the properties object used by resource loaders, etc, for property
           * substitution.  The default solr properties are prefixed with 'solr.core.', so,
           * e.g., 'name' becomes 'solr.core.name'
           */
          protected void buildSubstitutableProperties() {
            for (String propName : coreProperties.stringPropertyNames()) {
              String propValue = coreProperties.getProperty(propName);
              if (!isUserDefinedProperty(propName))
                propName = "solr.core." + propName;
              substitutableProperties.setProperty(propName, propValue);
            }
          }
        
        Show
        Steve Rowe added a comment - Was it intentional that the "name" property disappear? See SOLR-5281 Answering my own question: Yes: CoreDescriptor.java line #213 /** * Create the properties object used by resource loaders, etc, for property * substitution. The default solr properties are prefixed with 'solr.core.', so, * e.g., 'name' becomes 'solr.core.name' */ protected void buildSubstitutableProperties() { for ( String propName : coreProperties.stringPropertyNames()) { String propValue = coreProperties.getProperty(propName); if (!isUserDefinedProperty(propName)) propName = "solr.core." + propName; substitutableProperties.setProperty(propName, propValue); } }
        Hide
        Adrien Grand added a comment -

        4.5 release -> bulk close

        Show
        Adrien Grand added a comment - 4.5 release -> bulk close
        Adrien Grand made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Alan Woodward
            Reporter:
            Alan Woodward
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development