apache / apache/lucene

Remove Weakhashmap from CachingWrapperFilter [LUCENE-5696]

Open
#6,758 6 comments 0 reactions 0 assignees View on GitHub
legacy-jira-priority:Major type:bug
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

Filters can take up a good amount of space, I think its terrible this thing relies entirely upon weak references.

Actually I don't think it should use weak references at all, in my opinion, it should instead use a ConcurrentHashmap and coreClosedListeners to purge things.

We already ensure and test since #6615 that these listeners are always fired on close, even under exceptional cases, so I don't understand why we need weak references anywhere.

So maybe the fix is to just move up coreClosedListener to AtomicReader? And maybe nuke getCoreCacheKey and getCombinedCoreAndDeletesKey.

---
Migrated from [LUCENE-5696](https://issues.apache.org/jira/browse/LUCENE-5696) by Robert Muir (@rmuir)

Contributor guide

Open the contributing guide

Research direction

Start with CachingWrapperFilter and the coreClosedListener behavior discussed in #6615, then inspect the AtomicReader cache-key APIs mentioned in the issue. Done means deciding and implementing the cache cleanup approach, including whether the listener and cache-key changes are required, with tests covering exceptional core closure.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.