remove fieldcache weakmap or at least see what relies on GC for purging today [LUCENE-5177]
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
If we are registering close listeners why does this need to be weak?
But really i dont care about that, here is what i said to Hoss on the solr mailing list:
> > (In any case: it looks like a WeakHashMap is still used in case the
> > listeners never get called, correct?)
> >
>
> I think it might be the other way around: i think it was weakmap
> before always, the close listeners were then added sometime in 3\.x
> series, so we registered purge events "as an optimization"\.
>
> But one way to look at it is: readers should really get closed, so why
> have the weak map and not just a regular hashmap\.
>
> Even if we want to keep the weak map (seriously i dont care, and i
> dont want to be the guy fielding complaints on this), I'm going to
> open with an issue with a patch that removes it and fails tests in
> `@afterclass` if there is any entries\. This way its totally clear
> if/when/where anything is "relying on GC" today here and we can at
> least look at that\.
---
Migrated from [LUCENE-5177](https://issues.apache.org/jira/browse/LUCENE-5177) by Robert Muir (@rmuir), updated Aug 16 2013
Attachments: [LUCENE-5177.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-5177/LUCENE-5177.patch)
Contributor guide
Research direction
Start by reviewing the FieldCache implementation and its close-listener handling, then inspect the existing tests and the LUCENE-5177.patch attachment. Determine which behavior currently relies on WeakHashMap garbage collection and whether replacing it with a regular map is safe. Done means the chosen map behavior is covered and tests fail in @afterclass when entries remain.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- search
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100