Skip to content

Use DEFAULT_MAX_PERMITS constant in getSharedArenaMaxPermitsSysprop#15908

Merged
uschindler merged 5 commits intoapache:mainfrom
Huaixinww:fix-default_max_permits
Apr 3, 2026
Merged

Use DEFAULT_MAX_PERMITS constant in getSharedArenaMaxPermitsSysprop#15908
uschindler merged 5 commits intoapache:mainfrom
Huaixinww:fix-default_max_permits

Conversation

@Huaixinww
Copy link
Copy Markdown
Contributor

This PR is a follow-up to #15078
The previous change in #15078 intended to reduce the default value of SharedArenaMaxPermits from 1024 to 64 by updating RefCountedSharedArena.DEFAULT_MAX_PERMITS.

However, the change did not take effect because of a magic number in the getSharedArenaMaxPermitsSysprop() method:

private static int getSharedArenaMaxPermitsSysprop() {
    int ret = 1024; // default value

This magic number effectively overrides the DEFAULT_MAX_PERMITS constant, making the intended change from the previous PR ineffective.

This PR fixes the issue by replacing the magic number 1024 with the DEFAULT_MAX_PERMITS constant. This ensures that the default value is sourced from the constant as intended.

If there are other considerations here, please let me know.

@Huaixinww
Copy link
Copy Markdown
Contributor Author

hello @ChrisHegarty and @uschindler
We encountered an issue similar to #15068. After some analysis, we realized that the change from PR #15078 did not fully address the problem as intended. This new PR proposes what we believe is the correct fix.

We would appreciate it if you could review it to confirm whether this is indeed the reason.

@Huaixinww
Copy link
Copy Markdown
Contributor Author

One more thing. We found a related discussion on the mailing list here:
https://lists.apache.org/thread/4lqh5w9mxm4ffr5kxlxhh06d9gdv3gto

In the thread, Uwe Schindler mentioned a potential performance degradation in update-heavy scenarios if the limit is set back to 1. I've searched through related issues but couldn't find any specific benchmarks comparing these values.

I was wondering: has the Lucene project conducted any specific performance tests on this? For instance, a comparison of performance under heavy updates with the SharedArenaMaxPermits limit set to 1024, 64, and 1?

Any insights on this would be greatly appreciated.

@uschindler
Copy link
Copy Markdown
Contributor

uschindler commented Apr 1, 2026

Hi thanks for the correction, I noticed that problem, too.

About your question: You can't make a good benchamrk because that depends on load used, number of Threads and also JVM version. It is highly dependent on the used software. A major problem is Solr, which has some additional issues because it uses wrong IOContext to read "state" or "metadata files" during replication. It should use READ_ONCE there, currently it uses DEFAULT, which makes the problem get even larger.

@uschindler uschindler requested a review from ChrisHegarty April 1, 2026 11:00
@uschindler
Copy link
Copy Markdown
Contributor

Solr issues about the metadata files with wrong context: https://issues.apache.org/jira/browse/SOLR-17375

Please add a changes entry for Lucene 10.5. I will also check if it needs to be backported to 9.x as this is urgent and maybe Solr may need to update.

@uschindler uschindler self-assigned this Apr 1, 2026
@Huaixinww
Copy link
Copy Markdown
Contributor Author

Solr issues about the metadata files with wrong context: https://issues.apache.org/jira/browse/SOLR-17375

Please add a changes entry for Lucene 10.5. I will also check if it needs to be backported to 9.x as this is urgent and maybe Solr may need to update.

Thanks for ur feedback! I've added a changelog entry for this PR. Please let me know if there's anything else I need to change.

@github-actions github-actions bot added this to the 11.0.0 milestone Apr 1, 2026
@uschindler
Copy link
Copy Markdown
Contributor

Solr issues about the metadata files with wrong context: https://issues.apache.org/jira/browse/SOLR-17375
Please add a changes entry for Lucene 10.5. I will also check if it needs to be backported to 9.x as this is urgent and maybe Solr may need to update.

Thanks for ur feedback! I've added a changelog entry for this PR. Please let me know if there's anything else I need to change.

Can you move the changes entry to the 10.5 section, the changelog bot detected v 11.0?

@uschindler
Copy link
Copy Markdown
Contributor

In addition there seem to be some test problems. Maybe merge up to main branch's head. Looks like something is broken in the branch you're using. Please make sure it is latest stage.

@Huaixinww
Copy link
Copy Markdown
Contributor Author

Got it. Moved the change entry to 10.5 and synced with main.

@uschindler
Copy link
Copy Markdown
Contributor

Hi,
the test failures are coming from main branch. It's not your fault. Let's ignore those.

@github-actions github-actions bot modified the milestones: 11.0.0, 10.5.0 Apr 1, 2026
@uschindler
Copy link
Copy Markdown
Contributor

Perfect, will merge soon. Looks like @ChrisHegarty is on vacation.

@uschindler uschindler merged commit 79c028e into apache:main Apr 3, 2026
13 checks passed
@uschindler
Copy link
Copy Markdown
Contributor

We I'll cherry pick in 10x branch soon. No further action required.

@Huaixinww Huaixinww deleted the fix-default_max_permits branch April 3, 2026 08:33
@uschindler
Copy link
Copy Markdown
Contributor

Hi, backport is not so easy, because the constant in RefCountedSharedArena is not accessible in the MR-JAR framework in Lucene 10.x.

I will possibly backport with the hardcoded constant. That may have been the main reason why the hardcoded constant was used.

uschindler pushed a commit to uschindler/lucene that referenced this pull request Apr 3, 2026
…pache#15908)

* adjust SharedArenaMaxPermits to RefCountedSharedArena.DEFAULT_MAX_PERMITS

* add changes

* move change entry to 10.5

* adjust factory class to have access to default constant
@uschindler
Copy link
Copy Markdown
Contributor

Here is the backport PR. The code previously was a bit stupid (relic from 9.x branch), so I moved the check code into the provider: #15930

uschindler added a commit that referenced this pull request Apr 3, 2026
…15908) (#15930)

* adjust SharedArenaMaxPermits to RefCountedSharedArena.DEFAULT_MAX_PERMITS

* add changes

* move change entry to 10.5

* adjust factory class to have access to default constant

Co-authored-by: Huaixinww <141887897+Huaixinww@users.noreply.github.com>
@uschindler
Copy link
Copy Markdown
Contributor

Backport done.

@uschindler
Copy link
Copy Markdown
Contributor

The backport to 9.12 branch is here as the bug also exists there and was already released last September: #15931

uschindler pushed a commit to uschindler/lucene that referenced this pull request Apr 3, 2026
…pache#15908)

* adjust SharedArenaMaxPermits to RefCountedSharedArena.DEFAULT_MAX_PERMITS

* add changes

* move change entry to 10.5

* adjust factory class to have access to default constant
uschindler added a commit that referenced this pull request Apr 3, 2026
…15908) (#15931)

* adjust SharedArenaMaxPermits to RefCountedSharedArena.DEFAULT_MAX_PERMITS

* add changes

* adjust factory class to have access to default constant

Co-authored-by: Huaixinww <141887897+Huaixinww@users.noreply.github.com>
@uschindler
Copy link
Copy Markdown
Contributor

Backported to 9.12 branch.

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.

2 participants