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

SolrTestCaseJ4.deleteCore() does not delete/clean dataDir

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 8.3, 9.0
    • None
    • None

    Description

      Prior to Solr 8.3, the javadocs for SolrTestCaseJ4.deleteCore() said that that method would delete the dataDir used by initCore() in spite of that method not actaully doing anything to clean up the dataDir for a very long time (exactly when the bug was introduced is not known)

      For that reason, in most solr versions up to and including 8.2, tests that called combinations of initCore() / deleteCore() within a single test class would see the data from a previous core polluting the data of a newly introduced core.

      As part of this jira, this bug was fixed, by udpating deleteCore() to "reset" the value of the initCoreDataDir variable to null, so that it can/will be re-initialized on the next call to either initCore() or the lower level createCore()

      Existing tests that refer to the initCoreDataDir directly (either before, or during the lifecycle of an active core managed via initCore() / deleteCore() ) may encounter NullPointerExceptions on upgrading to Solr 8.3 as a result of this bug fix.  These tests are encouraged to use the new helper method initAndGetDataDir() in place of directly refering to the (now deprecated) initCoreDataDir variable directly.

      Any existing tests that refer to the initCoreDataDir directly after calling deleteCore() with the intention of inspecting the index contents after shutdown, will need to be modified to preserved the rsults of calling initAndGetDataDir() into a new variable for such introspection – the actual contents of the directory will not be removed until the full ifecycle of the test class is complete (see LuceneTestCase.createTempDir())

       

      Attachments

        1. SOLR-13664.patch
          24 kB
          Chris M. Hostetter
        2. SOLR-13664.patch
          13 kB
          Chris M. Hostetter
        3. SOLR-13664.patch
          7 kB
          Chris M. Hostetter
        4. SOLR-13664.patch
          2 kB
          Chris M. Hostetter

        Issue Links

          Activity

            People

              hossman Chris M. Hostetter
              hossman Chris M. Hostetter
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: