Solr
  1. Solr
  2. SOLR-2130

Empty index directory causes FileNotFoundException error when starting in-memory SOLR server (RAMDirectory)

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.4.1
    • Fix Version/s: None
    • Component/s: clients - java
    • Labels:
      None
    • Environment:

      Windows XP/Windows 7

      Description

      When creating an in-memory Solr Server (using RAMDIrectory) if an empty index directory exists when the server is created the following error occurs:

      java.lang.RuntimeException: java.io.FileNotFoundException: no segments* file found in org.apache.lucene.store.RAMDirectory@177b093: files:
      at org.apache.solr.core.SolrCore.getSearcher(SolrCore.java:1068)

      The code expects a segment file to be present - but as it is an in-memory server there isn't one to find and the error occurs.

      The workaround is to ensure the directory is deleted before starting the server, but the creation process creates another empty index folder

      1. TechSpike.zip
        4.68 MB
        Ian Rowland

        Activity

        Hide
        Andres Felipe Ospina added a comment -

        Response:

        attach in the solrconfig.xml

        <config>
        <directoryFactory name="DirectoryFactory" class="org.apache.solr.core.RAMDirectoryFactory"/>

        Show
        Andres Felipe Ospina added a comment - Response: attach in the solrconfig.xml <config> <directoryFactory name="DirectoryFactory" class="org.apache.solr.core.RAMDirectoryFactory"/>
        Hide
        Andres Felipe Ospina added a comment -

        Hi Ian,

        My name is Felipe and i want to use the index of solr in RAM memory.

        How it's possible? i have solr 1.4.1.

        Thank you!

        Andres

        Show
        Andres Felipe Ospina added a comment - Hi Ian, My name is Felipe and i want to use the index of solr in RAM memory. How it's possible? i have solr 1.4.1. Thank you! Andres
        Hide
        Ian Rowland added a comment -

        The attached file contains a self contained java project that will show the problem.

        Run the code in 'Main' (src/highlighting/techspike.solr.highlighting),

        The first time it is run the 'index' folder does not exist and the application completes (see output in Console window) .

        The second time it runs the 'Index' folder has been created but it empty: this causes the error to occur.

        If you delete the index directory and run the app again, it works!

        The application uses a RAMDirectory factory that is referenced in the SolrConfig.xml.

        The project includes the Solr libraries and they claim to be version 1.4.1!

        Show
        Ian Rowland added a comment - The attached file contains a self contained java project that will show the problem. Run the code in 'Main' (src/highlighting/techspike.solr.highlighting), The first time it is run the 'index' folder does not exist and the application completes (see output in Console window) . The second time it runs the 'Index' folder has been created but it empty: this causes the error to occur. If you delete the index directory and run the app again, it works! The application uses a RAMDirectory factory that is referenced in the SolrConfig.xml. The project includes the Solr libraries and they claim to be version 1.4.1!
        Hide
        Hoss Man added a comment -

        Ian: I'm afraid you haven't given enough details for me to really make sense of this bug.

        You've marked it as affecting Solr 1.4.1, but Solr 1.4.1 didn't have any support for using a RAMDirectory.

        On trunk, using the RAMDirectoryFactory with the example configs (which have a system property setup to override the default DirectoryFactory) I can't trigger any sort of problem like you describe...

        java -Dsolr.directoryFactory=solr.RAMDirectoryFactory -jar start.jar
        

        Can you please clarify how exactly you got the above mentioned error? Are you really using 1.4.1? Did you write a custom DirectoryFactory? what does your code look like? can you provide a unit test or specific steps to reproduce this error?

        Show
        Hoss Man added a comment - Ian: I'm afraid you haven't given enough details for me to really make sense of this bug. You've marked it as affecting Solr 1.4.1, but Solr 1.4.1 didn't have any support for using a RAMDirectory. On trunk, using the RAMDirectoryFactory with the example configs (which have a system property setup to override the default DirectoryFactory) I can't trigger any sort of problem like you describe... java -Dsolr.directoryFactory=solr.RAMDirectoryFactory -jar start.jar Can you please clarify how exactly you got the above mentioned error? Are you really using 1.4.1? Did you write a custom DirectoryFactory? what does your code look like? can you provide a unit test or specific steps to reproduce this error?

          People

          • Assignee:
            Unassigned
            Reporter:
            Ian Rowland
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:

              Development