-
Notifications
You must be signed in to change notification settings - Fork 2.3k
[Feature Request] Add support for a ForkJoinPool type #19008
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
Merged
Merged
Changes from 46 commits
Commits
Show all changes
103 commits
Select commit
Hold shift + click to select a range
c753c31
Initial chekpoint Feature Request - Add support for a ForkJoinPool type
7589b39
Merge upstream/main and FeatureRequest18674
4463d5a
Merge branch 'opensearch-project:main' into main
srikanthpadakanti e287c6f
Merge branch 'opensearch-project:main' into main
srikanthpadakanti 875221e
[Feature Request] Add support for a ForkJoinPool type - Add changelog…
ddf3d9d
[Feature Request] Add support for a ForkJoinPool type - Add changelog…
e8e2e83
Add support for a ForkJoinPool type - spotlessApply
f96fd0e
Initial chekpoint Feature Request - Add support for a ForkJoinPool type
5df90f6
Initial chekpoint Feature Request - Add support for a ForkJoinPool type
0d508b6
Initial chekpoint Feature Request - Add support for a ForkJoinPool type
30024e3
Initial chekpoint Feature Request - Add support for a ForkJoinPool type
71e254c
Initial chekpoint Feature Request - Add support for a ForkJoinPool type
c73c4d5
Initial chekpoint Feature Request - Add support for a ForkJoinPool type
cb433f8
Initial chekpoint Feature Request - Add support for a ForkJoinPool type
c1fa79c
Initial chekpoint Feature Request - Add support for a ForkJoinPool type
71aaad9
Initial chekpoint Feature Request - Add support for a ForkJoinPool type
c4781ba
Initial chekpoint Feature Request - Add support for a ForkJoinPool type
0fbd1c2
Merge branch 'opensearch-project:main' into main
srikanthpadakanti 0a683f7
Initial chekpoint Feature Request - Add support for a ForkJoinPool type
6b95c1b
Merge the upstream into my main
e235dd6
Add few more tests to cover the code
b42af66
Merge branch 'opensearch-project:main' into main
srikanthpadakanti fd10363
Add few more tests to cover the code
8b8225a
Backward Compatibility : fallback to FIXED for unknown types
24cbd53
Merge branch 'opensearch-project:main' into main
srikanthpadakanti ba4ab4d
Merge branch 'opensearch-project:main' into main
srikanthpadakanti ffacad4
Backward Compatibility : fallback to FIXED for unknown types
d73c0be
Merge branch 'opensearch-project:main' into main
srikanthpadakanti c053c6a
Backward Compatibility : fallback to FIXED for unknown types
6630cbc
Backward Compatibility : fallback to FIXED for unknown types
c6914ca
Merge branch 'opensearch-project:main' into main
srikanthpadakanti 0315fb6
Merge branch 'opensearch-project:main' into main
srikanthpadakanti 7b813db
Merge branch 'opensearch-project:main' into main
srikanthpadakanti 7f43e51
Merge branch 'opensearch-project:main' into main
srikanthpadakanti c9c9995
Merge branch 'opensearch-project:main' into main
srikanthpadakanti 698a95e
Addressed the PR comments
4877c83
Apply spotlesscheck
49ac561
Merge branch 'opensearch-project:main' into main
srikanthpadakanti 1b93311
Apply spotlesscheck and merge new changes to my main branch
009edeb
Apply spotlesscheck and merge new changes to my main branch
8949ccc
Merge branch 'opensearch-project:main' into main
srikanthpadakanti d60a5e5
Remove the allowlist and the registration method.
71f5d1f
Merge branch 'opensearch-project:main' into main
srikanthpadakanti 71322fa
Address the PR comments for the awaitTermination in threadpool
38377d2
Address the PR comments for the awaitTermination in threadpool
17a731d
Merge branch 'opensearch-project:main' into main
srikanthpadakanti 45cfd37
Merge branch 'opensearch-project:main' into main
srikanthpadakanti d3fc1d8
Addressed the PR comments
f30ed0d
Merge branch 'opensearch-project:main' into main
srikanthpadakanti 5850f98
Address the PR comments
68098e7
Address the PR comments
60c699f
Address the PR comments
d25f0c4
Address the PR comments
384e750
Merge branch 'opensearch-project:main' into main
srikanthpadakanti cb89bdd
Merge branch 'opensearch-project:main' into main
srikanthpadakanti ce6c139
Address the PR comments
779be1d
Address the PR comments
4ad3782
Merge branch 'opensearch-project:main' into main
srikanthpadakanti 9e36824
Merge branch 'opensearch-project:main' into main
srikanthpadakanti 5658e9f
Address the PR comments for Yaml tests
b9c706f
Address the PR comments for Yaml tests
f4fadbc
Address the PR comments for Yaml tests
eb7d36c
Address the PR comments for Yaml tests
d116df7
Address the PR comments for Yaml tests
cfd900f
Address the PR comments for Yaml tests
4fba6a7
Address the PR comments for Yaml tests
1fea0fc
Address the PR comments for Yaml tests
bfa2030
Address the PR comments for Yaml tests
a8b75be
Address the PR comments for Yaml tests
5aeeec4
Address the PR comments for Yaml tests
244ed19
Merge branch 'opensearch-project:main' into main
srikanthpadakanti 4d647c3
Address code review comments
6075fe7
Address code review comments
0736ed4
Address code review comments
c9a42d3
Address code review comments
85daa06
Address code review comments
3e37fc3
Address code review comments
af44937
Merge branch 'opensearch-project:main' into main
srikanthpadakanti cd7e77d
Merging upstream main to my main
f9698e7
Resolve merge conflicts
8259f2a
Introduce new settings in ForkJoinPoolExecutorBuilder
2578f2d
overload the constructor and keep the existing version for compatibil…
0dad905
Merge branch 'opensearch-project:main' into main
srikanthpadakanti bf2f8d4
Fix the precommit failure issues
e95f41e
Fix the precommit failure issues
c56a05d
Merge branch 'opensearch-project:main' into main
srikanthpadakanti f15d508
Fix the test failures for queue size
856e7d5
Fix the test failures for queue size
e069acb
Merge branch 'opensearch-project:main' into main
srikanthpadakanti 47e8b44
Added tests
251bc9f
Merge branch 'main' into main
srikanthpadakanti efcafd1
Merge branch 'opensearch-project:main' into main
srikanthpadakanti 2238404
Added tests for the codecoverage target
6d5db6f
Changed te scope of buildTable and removed reflection
c9762f5
Changed te scope of buildTable and removed reflection
9e52fcd
Merge branch 'opensearch-project:main' into main
srikanthpadakanti 5f55cd9
Changed the IT from plugin folder to single node IT with inline plugi…
1d64dba
Changed the IT from plugin folder to single node IT with inline plugi…
ab0a165
Merge branch 'opensearch-project:main' into main
srikanthpadakanti ca3f389
Changed the IT from plugin folder to single node IT with inline plugi…
f0ef745
Merge branch 'opensearch-project:main' into main
srikanthpadakanti 22a1086
Removed the build.gradle dependency opensearch-common
0511a4a
Removed the build.gradle dependency opensearch-common
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
rest-api-spec/src/main/resources/rest-api-spec/test/cat.thread_pool/20_fork_join_pool.yml
srikanthpadakanti marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| --- | ||
| "Test cat thread_pool fork_join output": | ||
| - skip: | ||
| version: " - 3.1.99" | ||
| reason: fork_join thread pool support was introduced in 3.2.0 | ||
| - do: | ||
| cat.thread_pool: | ||
| thread_pool_patterns: fork_join | ||
| h: node_name,name,type,active,queue,queue_size,rejected,largest,completed,max,keep_alive | ||
| v: true | ||
| # At least one row must contain 'fork_join' in name, optionally in type, and 0 for active, -1 for queue_size | ||
| - match: | ||
| $body: /fork_join.*0.*-1/ | ||
|
|
||
| --- | ||
| "Test cat thread_pool fork_join with unrelated pool": | ||
| - skip: | ||
| version: " - 3.1.99" | ||
| reason: fork_join thread pool support was introduced in 3.2.0 | ||
| - do: | ||
| cat.thread_pool: | ||
| thread_pool_patterns: fork_join,search | ||
| h: name,type,active,queue,queue_size,rejected | ||
| v: true | ||
| # At least one fork_join row must exist | ||
| - match: | ||
| $body: /fork_join.*0.*-1/ | ||
| # At least one search row, queue_size may be -1 or 1000, type can be blank or 'resizable' | ||
| - match: | ||
| $body: /search.*0.*(-1|1000)/ | ||
|
|
||
| --- | ||
| "Test cat thread_pool fork_join with only fork_join present": | ||
| - skip: | ||
| version: " - 3.1.99" | ||
| reason: fork_join thread pool support was introduced in 3.2.0 | ||
| - do: | ||
| cat.thread_pool: | ||
| thread_pool_patterns: fork_join | ||
| h: name,type,active,queue,queue_size,rejected | ||
| v: true | ||
| - match: | ||
| $body: /fork_join.*0.*-1/ | ||
|
|
||
| --- | ||
| "Test cat thread_pool fork_join with custom header order": | ||
| - skip: | ||
| version: " - 3.1.99" | ||
| reason: fork_join thread pool support was introduced in 3.2.0 | ||
| - do: | ||
| cat.thread_pool: | ||
| thread_pool_patterns: fork_join | ||
| h: queue,active,name,type | ||
| v: true | ||
| # Accept row with 0 queue, 0 active, fork_join in name, type may appear or not | ||
| - match: | ||
| $body: /0.*0.*fork_join/ | ||
|
|
||
| --- | ||
| "Test cat thread_pool fork_join missing optional columns": | ||
| - skip: | ||
| version: " - 3.1.99" | ||
| reason: fork_join thread pool support was introduced in 3.2.0 | ||
| - do: | ||
| cat.thread_pool: | ||
| thread_pool_patterns: fork_join | ||
| h: name,type,keep_alive,queue_size,max | ||
| v: true | ||
| # At least one fork_join row with -1 in keep_alive | ||
| - match: | ||
| $body: /fork_join.*-1/ | ||
|
|
||
| --- | ||
| "Test cat thread_pool fork_join with unknown header": | ||
| - skip: | ||
| version: " - 3.1.99" | ||
| reason: fork_join thread pool support was introduced in 3.2.0 | ||
| - do: | ||
| cat.thread_pool: | ||
| thread_pool_patterns: fork_join | ||
| h: name,type,foo,active | ||
| v: true | ||
| # At least one fork_join row with 0 in active | ||
| - match: | ||
| $body: /fork_join.*0/ | ||
|
|
||
| --- | ||
| "Test cat thread_pool fork_join with v:false": | ||
| - skip: | ||
| version: " - 3.1.99" | ||
| reason: fork_join thread pool support was introduced in 3.2.0 | ||
| - do: | ||
| cat.thread_pool: | ||
| thread_pool_patterns: fork_join | ||
| h: name,type,active | ||
| v: false | ||
| # At least one row with fork_join and 0 in active | ||
| - match: | ||
| $body: /fork_join.*0/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
server/src/main/java/org/opensearch/threadpool/ForkJoinPoolExecutorBuilder.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| /* | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * | ||
| * The OpenSearch Contributors require contributions made to | ||
| * this file be licensed under the Apache-2.0 license or a | ||
| * compatible open source license. | ||
| */ | ||
|
|
||
| package org.opensearch.threadpool; | ||
|
|
||
| import org.opensearch.common.settings.Setting; | ||
| import org.opensearch.common.settings.Settings; | ||
| import org.opensearch.common.util.concurrent.OpenSearchExecutors; | ||
| import org.opensearch.common.util.concurrent.ThreadContext; | ||
| import org.opensearch.node.Node; | ||
|
|
||
| import java.util.Arrays; | ||
| import java.util.List; | ||
| import java.util.Locale; | ||
| import java.util.concurrent.ForkJoinPool; | ||
| import java.util.concurrent.ForkJoinPool.ForkJoinWorkerThreadFactory; | ||
| import java.util.concurrent.ForkJoinWorkerThread; | ||
|
|
||
| /** | ||
| * A builder for fork join executors. | ||
| * | ||
| * @opensearch.internal | ||
| */ | ||
| public final class ForkJoinPoolExecutorBuilder extends ExecutorBuilder<ForkJoinPoolExecutorBuilder.ForkJoinPoolExecutorSettings> { | ||
|
|
||
| private final Setting<Integer> parallelismSetting; | ||
srikanthpadakanti marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| public ForkJoinPoolExecutorBuilder(final String name, final int parallelism) { | ||
srikanthpadakanti marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| this(name, parallelism, "thread_pool." + name); | ||
| } | ||
|
|
||
| public ForkJoinPoolExecutorBuilder(final String name, final int parallelism, final String prefix) { | ||
| super(name); | ||
| this.parallelismSetting = Setting.intSetting(settingsKey(prefix, "parallelism"), parallelism, Setting.Property.NodeScope); | ||
srikanthpadakanti marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| @Override | ||
| public List<Setting<?>> getRegisteredSettings() { | ||
| return Arrays.asList(parallelismSetting); | ||
| } | ||
|
|
||
| @Override | ||
| ForkJoinPoolExecutorSettings getSettings(Settings settings) { | ||
| final String nodeName = Node.NODE_NAME_SETTING.get(settings); | ||
| final int parallelism = parallelismSetting.get(settings); | ||
| return new ForkJoinPoolExecutorSettings(nodeName, parallelism); | ||
| } | ||
|
|
||
| @Override | ||
| ThreadPool.ExecutorHolder build(final ForkJoinPoolExecutorSettings settings, final ThreadContext threadContext) { | ||
| int parallelism = settings.parallelism; | ||
| ForkJoinWorkerThreadFactory factory = pool -> { | ||
| ForkJoinWorkerThread worker = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool); | ||
| worker.setName(OpenSearchExecutors.threadName(settings.nodeName, name())); | ||
| return worker; | ||
| }; | ||
| final ForkJoinPool executor = new ForkJoinPool(parallelism, factory, null, false); | ||
srikanthpadakanti marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| final ThreadPool.Info info = new ThreadPool.Info(name(), ThreadPool.ThreadPoolType.FORK_JOIN, parallelism, parallelism, null, null); | ||
| return new ThreadPool.ExecutorHolder(executor, info); | ||
| } | ||
|
|
||
| @Override | ||
| String formatInfo(ThreadPool.Info info) { | ||
| return String.format(Locale.ROOT, "name [%s], parallelism [%d]", info.getName(), info.getMax()); | ||
| } | ||
|
|
||
| static class ForkJoinPoolExecutorSettings extends ExecutorBuilder.ExecutorSettings { | ||
| private final int parallelism; | ||
|
|
||
| ForkJoinPoolExecutorSettings(final String nodeName, final int parallelism) { | ||
| super(nodeName); | ||
| this.parallelism = parallelism; | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.