apache / apache/lucene

improve getLiveDocs() performance [LUCENE-3500]

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

Description

On segmentReader, liveDocs is volatile because they used to be loaded on demand.
This no longer appears to be the case... liveDocs are always loaded up front.
This also means that getLiveDocs() can never fail (even after close), and we can remove the ensureOpen call.
Minor optimizations, but volatile reads still do prevent optimizations across that boundary.

---
Migrated from [LUCENE-3500](https://issues.apache.org/jira/browse/LUCENE-3500) by Yonik Seeley (@yonik)
Attachments: [LUCENE-3500.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-3500/LUCENE-3500.patch)

Contributor guide

Open the contributing guide

Research direction

Start at SegmentReader's liveDocs field and getLiveDocs() method, then inspect how liveDocs is initialized and whether it is always available before access. The work is done when the unnecessary volatile and ensureOpen behavior described in the issue are removed without changing live-docs behavior, including access after close.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.