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

Add a factory corresponding to NoMergePolicy

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.1, 4.0-ALPHA
    • Fix Version/s: 6.3, master (7.0)
    • Component/s: multicore
    • Labels:
      None

      Description

      Solr cannot use the Lucene NoMergePolicy class. It will not instantiate correctly when loading the core.
      Other MergePolicy classes work, including the BalancedSegmentMergePolicy.

      This is in trunk and 3.x.

      1. SOLR-2212.patch
        5 kB
        Cao Manh Dat

        Activity

        Hide
        lancenorskog Lance Norskog added a comment -

        This test is in trunk/solr/example and branch_3x/solr/example.
        I set the MergePolicy in solrconfig.xml to the NoMergePolicy class with this line:

          <mergePolicy class="org.apache.lucene.index.NoMergePolicy"/>
        

        When I start solr I get the following stack trace.

        Nov 1, 2010 10:43:40 PM org.apache.solr.common.SolrException log
        SEVERE: org.apache.solr.common.SolrException: Error instantiating class: 'org.apache.lucene.index.NoMergePolicy'
        	at org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:432)
        	at org.apache.solr.update.SolrIndexWriter.init(SolrIndexWriter.java:83)
        	at org.apache.solr.update.SolrIndexWriter.<init>(SolrIndexWriter.java:197)
        	at org.apache.solr.core.SolrCore.initIndex(SolrCore.java:399)
        	at org.apache.solr.core.SolrCore.<init>(SolrCore.java:550)
        	at org.apache.solr.core.CoreContainer.create(CoreContainer.java:660)
        	at org.apache.solr.core.CoreContainer.load(CoreContainer.java:412)
        	at org.apache.solr.core.CoreContainer.load(CoreContainer.java:294)
        	at org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:243)
        	at org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:86)
        	at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
        	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
        	at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:662)
        	at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
        	at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
        	at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
        	at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
        	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
        	at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
        	at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
        	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
        	at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
        	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
        	at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
        	at org.mortbay.jetty.Server.doStart(Server.java:224)
        	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
        	at org.mortbay.xml.XmlConfiguration.main(XmlConfiguration.java:985)
        	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        	at java.lang.reflect.Method.invoke(Method.java:597)
        	at org.mortbay.start.Main.invokeMain(Main.java:194)
        	at org.mortbay.start.Main.start(Main.java:534)
        	at org.mortbay.start.Main.start(Main.java:441)
        	at org.mortbay.start.Main.main(Main.java:119)
        Caused by: java.lang.InstantiationException: org.apache.lucene.index.NoMergePolicy
        	at java.lang.Class.newInstance0(Class.java:340)
        	at java.lang.Class.newInstance(Class.java:308)
        	at org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:429)
        	... 34 more
        
        
        Show
        lancenorskog Lance Norskog added a comment - This test is in trunk/solr/example and branch_3x/solr/example. I set the MergePolicy in solrconfig.xml to the NoMergePolicy class with this line: <mergePolicy class= "org.apache.lucene.index.NoMergePolicy" /> When I start solr I get the following stack trace. Nov 1, 2010 10:43:40 PM org.apache.solr.common.SolrException log SEVERE: org.apache.solr.common.SolrException: Error instantiating class: 'org.apache.lucene.index.NoMergePolicy' at org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:432) at org.apache.solr.update.SolrIndexWriter.init(SolrIndexWriter.java:83) at org.apache.solr.update.SolrIndexWriter.<init>(SolrIndexWriter.java:197) at org.apache.solr.core.SolrCore.initIndex(SolrCore.java:399) at org.apache.solr.core.SolrCore.<init>(SolrCore.java:550) at org.apache.solr.core.CoreContainer.create(CoreContainer.java:660) at org.apache.solr.core.CoreContainer.load(CoreContainer.java:412) at org.apache.solr.core.CoreContainer.load(CoreContainer.java:294) at org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:243) at org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:86) at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:662) at org.mortbay.jetty.servlet.Context.startContext(Context.java:140) at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250) at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517) at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152) at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) at org.mortbay.jetty.Server.doStart(Server.java:224) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.xml.XmlConfiguration.main(XmlConfiguration.java:985) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.mortbay.start.Main.invokeMain(Main.java:194) at org.mortbay.start.Main.start(Main.java:534) at org.mortbay.start.Main.start(Main.java:441) at org.mortbay.start.Main.main(Main.java:119) Caused by: java.lang.InstantiationException: org.apache.lucene.index.NoMergePolicy at java.lang. Class .newInstance0( Class .java:340) at java.lang. Class .newInstance( Class .java:308) at org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:429) ... 34 more
        Hide
        hossman Hoss Man added a comment -

        <mergePolicy> (and most of the SolrPlugin stuff) requires that the class specified support a no-arg constructor.

        "NoMergePolicy" has no public constructors at all - it seems to expect you to only ever use one of the Static singletons.

        Show
        hossman Hoss Man added a comment - <mergePolicy> (and most of the SolrPlugin stuff) requires that the class specified support a no-arg constructor. "NoMergePolicy" has no public constructors at all - it seems to expect you to only ever use one of the Static singletons.
        Hide
        lancenorskog Lance Norskog added a comment - - edited

        Also, it expects you to tell it whether to use compound files.

        This signature structure just plain does not work with the solrconfig.xml structure. The fact that the merge policy has to embed whether to use compound files seems like an information leakage anyway. The MergePolicy returns lists of segments, that's it. Knowing whether to use compound files is extraneous to its mission.

        Show
        lancenorskog Lance Norskog added a comment - - edited Also, it expects you to tell it whether to use compound files. This signature structure just plain does not work with the solrconfig.xml structure. The fact that the merge policy has to embed whether to use compound files seems like an information leakage anyway. The MergePolicy returns lists of segments, that's it. Knowing whether to use compound files is extraneous to its mission.
        Hide
        caomanhdat Cao Manh Dat added a comment - - edited

        Now, mergePolicy accept a MergePolicyFactory. So I think we can close this issue here and open another ticket like "NoMergePolicyFactory" to add a new NoMergePolicyFactory for Solr.

        Show
        caomanhdat Cao Manh Dat added a comment - - edited Now, mergePolicy accept a MergePolicyFactory. So I think we can close this issue here and open another ticket like "NoMergePolicyFactory" to add a new NoMergePolicyFactory for Solr.
        Hide
        caomanhdat Cao Manh Dat added a comment -

        Added NoMergePolicyFactory for lastest source.

        Show
        caomanhdat Cao Manh Dat added a comment - Added NoMergePolicyFactory for lastest source.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 768c7e2648557d10f231f49a7c76eb040cbbcb0e in lucene-solr's branch refs/heads/master from Shalin Shekhar Mangar
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=768c7e2 ]

        SOLR-2212: Add a factory class corresponding to Lucene's NoMergePolicy

        Show
        jira-bot ASF subversion and git services added a comment - Commit 768c7e2648557d10f231f49a7c76eb040cbbcb0e in lucene-solr's branch refs/heads/master from Shalin Shekhar Mangar [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=768c7e2 ] SOLR-2212 : Add a factory class corresponding to Lucene's NoMergePolicy
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 3628b0a0c859b59f72324139bcf163f323afd6e3 in lucene-solr's branch refs/heads/branch_6x from Shalin Shekhar Mangar
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=3628b0a ]

        SOLR-2212: Add a factory class corresponding to Lucene's NoMergePolicy

        (cherry picked from commit 768c7e2)

        Show
        jira-bot ASF subversion and git services added a comment - Commit 3628b0a0c859b59f72324139bcf163f323afd6e3 in lucene-solr's branch refs/heads/branch_6x from Shalin Shekhar Mangar [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=3628b0a ] SOLR-2212 : Add a factory class corresponding to Lucene's NoMergePolicy (cherry picked from commit 768c7e2)
        Hide
        shalinmangar Shalin Shekhar Mangar added a comment -

        Thanks for the patch Dat!

        Show
        shalinmangar Shalin Shekhar Mangar added a comment - Thanks for the patch Dat!
        Hide
        shalinmangar Shalin Shekhar Mangar added a comment -

        Closing after 6.3.0 release.

        Show
        shalinmangar Shalin Shekhar Mangar added a comment - Closing after 6.3.0 release.

          People

          • Assignee:
            shalinmangar Shalin Shekhar Mangar
            Reporter:
            lancenorskog Lance Norskog
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development