Skip to content

Reapply "Update the IOContext rather than the ReadAdvice on IndexInput (#14702)" #14844

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

thecoop
Copy link
Contributor

@thecoop thecoop commented Jun 25, 2025

Reapply #14702

Copy link

This PR does not have an entry in lucene/CHANGES.txt. Consider adding one. If the PR doesn't need a changelog entry, then add the skip-changelog label to it and you will stop receiving this reminder on future updates to the PR.

@thecoop
Copy link
Contributor Author

thecoop commented Jun 25, 2025

@dweiss The tests here all pass, what's the original failure with #14702 ?

@dweiss
Copy link
Contributor

dweiss commented Jun 25, 2025

Don't know if you're subscribed -
https://lists.apache.org/list.html?builds@lucene.apache.org

Tests are randomized - sometimes a different reshuffle of components may not succeed after a patch. Here's an example:
https://ci-builds.apache.org/job/Lucene/job/Lucene-Check-main/13302/console

I haven't tried if it reproduces or not - I'm very limited today - seems like the builds have gone back to normal after I reverted the patch though, so something is not right?

@thecoop
Copy link
Contributor Author

thecoop commented Jun 25, 2025

Yes, that's caused by this PR... It reproduces, but only intermittently...

@dweiss
Copy link
Contributor

dweiss commented Jun 25, 2025

I get a high failure ratio with this:

./gradlew :lucene:core:test  --tests "org.apache.lucene.index.TestConcurrentMergeScheduler.testNoWaitClose" -Ptests.file.encoding=US-ASCII -Ptests.forceintegervectors=true -Ptests.gui=true -Ptests.haltonfailure=false -Ptests.jvmargs= -Ptests.jvms=4 -Ptests.multiplier=2 -Ptests.vectorsize=128 -Ptests.iters=50 -Ptests.seed=ACE84AE4C131D76C

Copy link

This PR does not have an entry in lucene/CHANGES.txt. Consider adding one. If the PR doesn't need a changelog entry, then add the skip-changelog label to it and you will stop receiving this reminder on future updates to the PR.

@@ -228,8 +245,6 @@ public Map<String, Long> getOffHeapByteSize(FieldInfo fieldInfo) {

@Override
public void close() throws IOException {
assert !mergeInstance;
delegate.close();
delegate.close();
assert finishMergeCount.get() <= 0 || mergeInstanceCount.get() == finishMergeCount.get();
Copy link
Contributor Author

@thecoop thecoop Jun 26, 2025

Choose a reason for hiding this comment

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

This was the line causing the problems (which was modified in the original PR) - its ok for close() to be called when there's an open merge instance, if the merge is aborted - which is what testNoWaitClose is doing

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sitting that deep in codecs. @jpountz is much better fitted for the review of this.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would expect Lucene to never close merge instances, since merge instances are conceptually like clones, and Lucene doesn't close clones.

That said, it looks like we should make sure that finishMerge is always called - even if the merge fails or is aborted, otherwise aborted merges would leave readers open with the wrong read advice?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is an issue with the code calling finishMerge, not in this PR. Shall I merge this change, then look at pinning down the missing finishMerge separately?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've found the cause here

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.

3 participants