Skip to content
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

Limiting the number of nested pipelines that can be executed #105428

Merged
merged 9 commits into from Feb 13, 2024

Conversation

masseyke
Copy link
Member

@masseyke masseyke commented Feb 12, 2024

This limits the number of nested pipelines that can be executed from within a single pipeline to 100 (configurable via a system property called es.ingest.max_pipelines).

@masseyke masseyke added >enhancement :Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP v8.13.0 labels Feb 12, 2024
@elasticsearchmachine
Copy link
Collaborator

Hi @masseyke, I've created a changelog YAML for you.

@@ -40,6 +41,9 @@
*/
public class ManyNestedPipelinesIT extends ESIntegTestCase {
private final int manyPipelinesCount = randomIntBetween(2, 50);
private final int tooManyPipelinesCount = 102;
Copy link
Member Author

Choose a reason for hiding this comment

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

This can be set to 101 if we decide to merge #105427.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good, let's get that one merged in and then update this PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@masseyke masseyke marked this pull request as ready for review February 13, 2024 13:50
@elasticsearchmachine elasticsearchmachine added the Team:Data Management Meta label for data/management team label Feb 13, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

@@ -51,6 +51,8 @@ public final class IngestDocument {

private static final String PIPELINE_CYCLE_ERROR_MESSAGE = "Cycle detected for pipeline: ";
static final String TIMESTAMP = "timestamp";
// This is the maximum number of nested pipelines that can be within a pipeline. If there are more, we bail out with an error
private static final int MAX_PIPELINES = Integer.parseInt(System.getProperty("ingest.max_pipelines", "100"));
Copy link
Contributor

Choose a reason for hiding this comment

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

A very minor nit, but I think es.ingest.max_pipelines would be just a little better.

@@ -829,7 +831,12 @@ public void executePipeline(Pipeline pipeline, BiConsumer<IngestDocument, Except
return;
}

if (executedPipelines.add(pipeline.getId())) {
if (executedPipelines.size() >= MAX_PIPELINES) {
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 just thinking aloud to myself in a comment: if we have already executed X pipelines, and X is the max, then we should not execute X+1 pipelines because then we'd be executing more pipelines than the max. So there's not an off by one error here, and I'm in agreement with this logic. For the record I was considering if this if was misplaced and might have been better after the executedPipelines.add(...) call below, but this is right and good.

@masseyke masseyke merged commit f0ec294 into elastic:main Feb 13, 2024
14 checks passed
@masseyke masseyke deleted the limit-pipelines branch February 13, 2024 22:28
masseyke added a commit to masseyke/elasticsearch that referenced this pull request Feb 14, 2024
…#105428)

Limiting the number of nested pipelines that can be executed within a single pipeline to 100
masseyke added a commit that referenced this pull request Feb 15, 2024
#105533)

Limiting the number of nested pipelines that can be executed within a single pipeline to 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>breaking :Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP >enhancement Team:Data Management Meta label for data/management team v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants