MonitorConfiguration should support disabling scheduled purgeCache [LUCENE-10675]
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
Monitors (using WritableQueryIndex) automatically create a private ScheduledExecutor using a hardcoded ThreadFactory to schedule a periodic call to the `purgeCache()` method.
The frequency of this periodic schedule can be adjusted via MonitorConifguration – but it can't be disabled.
This seems odd because:
- `purgeCache()` is a public method that applications using a Monitor can invoke themselves (possible via their own ScheduledExecutor)
- In a lot of usecases there's no need for periodicly calling this method – it's enough to call exactly once after `register()`}-ing or `deleteById()`}-ing one or more batches of `MonitorQuery` objects. there is zero reason to call it again unless/untill something changes.
----
I propose we tweak the MonitorConfiguration API spec, and the use of the configuration in the code, such that if the configured purgeFrequency is a negative number, The `purgeExecutor` remains null (and no Executor is ever created)
---
Migrated from [LUCENE-10675](https://issues.apache.org/jira/browse/LUCENE-10675) by Chris M. Hostetter (@hossman)
Contributor guide
Research direction
Start by reading MonitorConfiguration and the scheduled purge usage in WritableQueryIndex, then trace how purgeCache() is invoked after register() and deleteById(). Done means a negative purgeFrequency leaves purgeExecutor null and no executor is created, while existing scheduling behavior remains available for non-negative values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- search
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100