-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Limit CS Update Task Description Size #79443
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 all commits
5e16e8d
c4309e9
dc041cc
596e200
1f3e3ab
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 |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ | |
| package org.elasticsearch.cluster.service; | ||
|
|
||
| import org.apache.logging.log4j.Logger; | ||
| import org.elasticsearch.common.Strings; | ||
| import org.elasticsearch.core.Nullable; | ||
| import org.elasticsearch.common.Priority; | ||
| import org.elasticsearch.core.TimeValue; | ||
|
|
@@ -131,14 +132,28 @@ void runIfNotProcessed(BatchedTask updateTask) { | |
| } | ||
|
|
||
| if (toExecute.isEmpty() == false) { | ||
| final String tasksSummary = processTasksBySource.entrySet().stream().map(entry -> { | ||
| run(updateTask.batchingKey, toExecute, buildTasksDescription(updateTask, toExecute, processTasksBySource)); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private static final int MAX_TASK_DESCRIPTION_CHARS = 8 * 1024; | ||
|
|
||
| private String buildTasksDescription(BatchedTask updateTask, | ||
|
Contributor
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. Likewise here I think?
Contributor
Author
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. Here it's a little less fun to use the general string builder than in the other case because I think it'd be nice to have the overall task count?
Contributor
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. I'm confused:
Contributor
Author
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. But we have this weird setup here where we have the tasks grouped by source so the counting will only work out correctly if the source is different for each task? I kinda liked having that level of detail on the counts for debugging still.
Contributor
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. Oh I see we use How about either just appending |
||
| List<BatchedTask> toExecute, | ||
| Map<String, List<BatchedTask>> processTasksBySource) { | ||
| final StringBuilder output = new StringBuilder(); | ||
| Strings.collectionToDelimitedStringWithLimit( | ||
| (Iterable<String>) () -> processTasksBySource.entrySet().stream().map(entry -> { | ||
| String tasks = updateTask.describeTasks(entry.getValue()); | ||
| return tasks.isEmpty() ? entry.getKey() : entry.getKey() + "[" + tasks + "]"; | ||
| }).reduce((s1, s2) -> s1 + ", " + s2).orElse(""); | ||
|
|
||
| run(updateTask.batchingKey, toExecute, tasksSummary); | ||
| } | ||
| }).filter(s -> s.isEmpty() == false).iterator(), | ||
| ", ", "", "", MAX_TASK_DESCRIPTION_CHARS, output | ||
| ); | ||
| if (output.length() > MAX_TASK_DESCRIPTION_CHARS) { | ||
| output.append(" (").append(toExecute.size()).append(" tasks in total)"); | ||
| } | ||
| return output.toString(); | ||
| } | ||
|
|
||
| /** | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.