Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-17362

GridLuceneFile filename remains in the GridLuceneDirectory.fileMap after IndexOutput was closed

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.13
    • None
    • None
    • None

    Description

      Found during work for IGNITE-16337

      I'm not sure whether this is a bug or not, need someone who has good understanding of lucene related machinery.

      package org.apache.ignite.internal.processors.query.h2.opt;
      
      // imports
      
      public class GridLuceneDirectoryTest extends GridCommonAbstractTest {
      
          private GridLuceneDirectory dir;
      
          @Before
          public void setUp() throws Exception {
              dir = new GridLuceneDirectory(new GridUnsafeMemory(0));
          }
      
          @Test
          public void testReleaseRefShouldRemoveFileNameFromDirMap() throws IOException {
              final String fileName = "foo";
      
              assertNoFilenames();
              IndexOutput indexOutput = dir.createOutput(fileName, IOContext.DEFAULT);
              assertTrue("Missing created file: " + fileName, dirFileNames().contains(fileName));
      
              indexOutput.close();
      
              // Now underlying file ref count is 0 that triggers GridLuceneFile.deferredDelete()
              // however dir would still hold a reference to this file in GridLuceneDirectory.fileMap
              assertNoFilenames();
              assertNoPendingDeletions();
          }
      
          private List<String> dirFileNames() {
              return Arrays.asList(dir.listAll());
          }
      
          private void assertNoFilenames() {
              assertTrue("Lucene Directory is not empty", dirFileNames().isEmpty());
          }
      
          private void assertNoPendingDeletions() throws IOException {
              assertTrue("Pending deletions is not empty", dir.getPendingDeletions().isEmpty());
          }
      }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            Korol Ilya Korol
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: