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()); } }