-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Use TaskId in TaskAwareRequest.createRequest #130131
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
Changes from 9 commits
0f9d2bd
717d483
9cbfdf2
7594b8b
be57c9b
28eefa8
2a6102e
8216022
d4de01c
a1a5803
57324d9
164de88
8fe47d9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ | |
| import org.elasticsearch.cluster.ClusterStateApplier; | ||
| import org.elasticsearch.cluster.node.DiscoveryNode; | ||
| import org.elasticsearch.cluster.node.DiscoveryNodes; | ||
| import org.elasticsearch.common.UUIDs; | ||
| import org.elasticsearch.common.settings.Settings; | ||
| import org.elasticsearch.common.unit.ByteSizeValue; | ||
| import org.elasticsearch.common.util.concurrent.AbstractRunnable; | ||
|
|
@@ -80,6 +81,7 @@ public class TaskManager implements ClusterStateApplier { | |
|
|
||
| private TaskResultsService taskResultsService; | ||
|
|
||
| private final String nodeId; | ||
| private DiscoveryNodes lastDiscoveryNodes = DiscoveryNodes.EMPTY_NODES; | ||
|
|
||
| private final Tracer tracer; | ||
|
|
@@ -96,10 +98,15 @@ public TaskManager(Settings settings, ThreadPool threadPool, Set<String> taskHea | |
| } | ||
|
|
||
| public TaskManager(Settings settings, ThreadPool threadPool, Set<String> taskHeaders, Tracer tracer) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please mention with a comment this is just for tests (creating the uuid). we should move all these uses to explicitly pass a test nodeid, but that can be a followup There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
| this(settings, threadPool, taskHeaders, tracer, UUIDs.randomBase64UUID()); | ||
| } | ||
|
|
||
| public TaskManager(Settings settings, ThreadPool threadPool, Set<String> taskHeaders, Tracer tracer, String nodeId) { | ||
| this.threadPool = threadPool; | ||
| this.taskHeaders = Set.copyOf(taskHeaders); | ||
| this.maxHeaderSize = SETTING_HTTP_MAX_HEADER_SIZE.get(settings); | ||
| this.tracer = tracer; | ||
| this.nodeId = nodeId; | ||
| } | ||
|
|
||
| public void setTaskResultsService(TaskResultsService taskResultsService) { | ||
|
|
@@ -142,8 +149,7 @@ public Task register(String type, String action, TaskAwareRequest request, boole | |
| } | ||
| } | ||
| Task task = request.createTask( | ||
| lastDiscoveryNodes.getLocalNodeId(), | ||
| taskIdGenerator.incrementAndGet(), | ||
| new TaskId(nodeId, taskIdGenerator.incrementAndGet()), | ||
| type, | ||
| action, | ||
| request.getParentTask(), | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seemed all clients passed the same
Settings.EMPTY, interceptor, andnullin theclusterSettingsto this constructor (refactored to a factory method), so I've simplified the method by removing those parameters.