Skip to content

Avoid flushing pending DocValues updates to disk for merging segments - #17053

Merged
jainankitk merged 3 commits into
apache:mainfrom
kkewwei:avoid_write_update_merge
Nov 25, 2026
Merged

jainankitk merged 3 commits into
apache:mainfrom
kkewwei:avoid_write_update_merge

Conversation

@kkewwei

@kkewwei kkewwei commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Description

For example, segmentsa andb are merged intoc .

https://github.com/apache/lucene/blob/main/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java#L5484
When reader pooling is disabled, releasinga during merge cleanup can flush its pending DocValues updates to disk. This write is unnecessary becausea has already been merged away.

The write triggerscheckpointNoSIS() . Since botha andb have already been removed fromsegmentInfos , the checkpoint decrements the references tob ’s existing DV update files and may delete them prematurely.
https://github.com/apache/lucene/blob/main/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java#L6882

Whenb is subsequently released, flushing its pending DV updates needs to read those deleted files to fold the existing deltas, causingFileNotFoundException .

Resolved #17048.

shbhar added a commit to shbhar/lucene-ai-bug-hunt that referenced this pull request Nov 21, 2026
…ngs (LFV-1569 to LFV-1574), all Low, each with a repro: three on the Albanian analysis package that was added to Lucene main and to branch_11x, the 11.0 release branch, on 2026-11-20 (apache/lucene#16957), marked new in 11.0 (LFV-1572: lucene-analysis-common exports the package org.apache.lucene.analysis.sq and does not open it to org.apache.lucene.core, so with Lucene on the module path a resource loader cannot open its word lists; LFV-1574: the normalizer folds the decomposed spelling of a listed word differently from the precomposed one; LFV-1573: two class javadocs name the wrong letter); LFV-1570 (a merge that starts from an existing HNSW graph can leave live documents out of reach of graph search); and two findings on released lines only, shown as fixed before they were listed (LFV-1569, known upstream as apache/lucene#16887 and fixed by #16947; LFV-1571, where main and branch_11x no longer have the code since #16834); five of the six are new and one was already known upstream; LFV-1563 and LFV-1055 show "Fix in progress upstream" with apache/lucene#17053 and #17054; the sentences about #17018 (merged on 2026-11-20) and #16306 brought to the state of that day; LFV-110: two sentences now carry the condition under which a forced merge commits the old value; on findings whose text changed, sentences about what open pull requests of other people do not change were cut; the published repros re-run on Lucene main 7b8418faa2ff (no outcome changed); the list has 1,474 findings, 1,168 new and 306 already known (217 upstream, 89 outside Lucene), 62 of them marked new in 11.0.

@jainankitk jainankitk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kkewwei, nice find! The fix looks right to me. A few small things inline, mainly the CHANGES entry.

Comment thread lucene/CHANGES.txt Resolved
@kkewwei

kkewwei commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

@jainankitk Very thank you for the review, please have another look in your spare time.

@jainankitk
jainankitk merged commit 77d56fe into apache:main Nov 25, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TestAddIndexes.testAddIndicesWithSoftDeletes failure

2 participants