[
https://issues.apache.org/jira/browse/IGNITE-17362?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ilya Korol updated IGNITE-17362:
--------------------------------
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.
{code:java}
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());
}
}
{code}
was:
I'm not sure whether this is a bug or not, need someone who has good
understanding of lucene related machinery.
{code:java}
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());
}
}
{code}
> GridLuceneFile filename remains in the GridLuceneDirectory.fileMap after
> IndexOutput was closed
> -----------------------------------------------------------------------------------------------
>
> Key: IGNITE-17362
> URL: https://issues.apache.org/jira/browse/IGNITE-17362
> Project: Ignite
> Issue Type: Bug
> Affects Versions: 2.13
> Reporter: Ilya Korol
> Priority: Minor
>
> 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.
> {code:java}
> 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());
> }
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)