Skip to content

Conversation

houssain-barouni
Copy link
Collaborator

@houssain-barouni houssain-barouni commented Aug 12, 2025

This pull request introduces support for dynamic application of number_of_replicas and number_of_shards configuration changes at application startup, ensuring consistent schema management across Elasticsearch and OpenSearch implementations for both Operate and Tasklist.

  • New updateIndexSettings() method in the schema manager that runs on application startup when both camunda.operate.elasticsearch.createSchema and the new camunda.operate.elasticsearch.updateSchemaSettings properties are enabled

  • Dynamic index updates: automatically updates the replicas count of all existing indices using either global replica configuration or per-index specific configuration

  • Index Templates: updates shards/replicas count settings in index templates to match current configuration values (global or per-index)

  • Component template: updates the operate_component component template settings with current global shards/replicas configuration

  • Implementation Consistency: aling behavior between Elasticsearch and OpenSearch implementations. Previously, Elasticsearch always set shards/replicas at index template level while OpenSearch only set them when different from defaults, both implementations now consistently set index template settings regardless of default values, this is consistent with 8.8 implementation
    Testing Infrastructure:

  • there was a discrepency between Elasticsearch and Opensearch implementation: for Elasticsearch, the shards/replicas settings are always set at index template level, while for Opensearch they are set only when different from the default global configuration. Aligned both implementations to always set the index template settings (also for Tasklist) , this will be also the behavior of 8.8

  • Expanded the integration operateItOpensearch test profile in operate/pom.xml to include schema-related tests to be run in Opensearch IT tests.

Description

Checklist

Related issues

closes #32872

@github-actions github-actions bot added the component/operate Related to the Operate component/team label Aug 12, 2025
Base automatically changed from hb-fix-31238 to stable/8.7 August 12, 2025 09:59
@github-actions github-actions bot added the component/tasklist Related to the Tasklist component/team label Aug 18, 2025
@houssain-barouni houssain-barouni force-pushed the hb-fix-32872 branch 3 times, most recently from dff82f2 to 879575d Compare August 18, 2025 13:50
@houssain-barouni houssain-barouni changed the title fix: Use number_of_replicas and number_of_shards Elasticsearch confi… Apply number_of_replicas and number_of_shards ES/OS configuration changes Aug 18, 2025
Copilot

This comment was marked as outdated.

@houssain-barouni houssain-barouni marked this pull request as ready for review August 18, 2025 14:21
@houssain-barouni houssain-barouni requested review from panagiotisgts and a team August 18, 2025 14:21
@houssain-barouni houssain-barouni added the backport stable/8.6 Backport a pull request to stable/8.6 label Aug 19, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request introduces dynamic application of number_of_replicas and number_of_shards configuration changes for Elasticsearch and OpenSearch implementations across both Operate and Tasklist applications. The changes enable automatic updates to index settings and templates at application startup when schema creation and the new updateSchemaSettings property are enabled.

Key Changes:

  • Added updateIndexSettings() method to schema managers that updates existing indices, index templates, and component templates with current configuration values
  • Introduced new updateSchemaSettings configuration property to control when schema settings updates should be applied
  • Aligned Elasticsearch and OpenSearch implementations to consistently set index template settings regardless of default values

Reviewed Changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated no comments.

Show a summary per file
File Description
operate/schema/src/main/java/io/camunda/operate/schema/SchemaStartup.java Integrates the new updateIndexSettings() call into the schema initialization process
operate/schema/src/main/java/io/camunda/operate/schema/SchemaManager.java Adds the updateIndexSettings() method interface and related constants
operate/schema/src/main/java/io/camunda/operate/schema/elasticsearch/ElasticsearchSchemaManager.java Implements comprehensive index settings update logic for Elasticsearch
operate/schema/src/main/java/io/camunda/operate/schema/opensearch/OpensearchSchemaManager.java Implements comprehensive index settings update logic for OpenSearch
operate/common/src/main/java/io/camunda/operate/property/ElasticsearchProperties.java Adds updateSchemaSettings configuration property
operate/common/src/main/java/io/camunda/operate/property/OpensearchProperties.java Adds updateSchemaSettings configuration property
operate/common/src/main/java/io/camunda/operate/property/OperateElasticsearchProperties.java Adds helper methods for retrieving per-index settings
operate/common/src/main/java/io/camunda/operate/property/OperateOpensearchProperties.java Adds helper methods for retrieving per-index settings
tasklist/els-schema/src/main/java/io/camunda/tasklist/schema/manager/ElasticsearchSchemaManager.java Implements index template settings update for Tasklist Elasticsearch
tasklist/els-schema/src/main/java/io/camunda/tasklist/schema/manager/OpenSearchSchemaManager.java Implements index template settings update for Tasklist OpenSearch
Test files Extensive integration tests covering the new functionality across both Elasticsearch and OpenSearch
Comments suppressed due to low confidence (1)

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Copy link
Contributor

@RomanJRW RomanJRW left a comment

Choose a reason for hiding this comment

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

I don't know this part of Operate/Tasklist very well but the changes seem reasonable to me and I mostly get confidence because the new tests are broad and thorough in the behaviour that they are testing.

Some possible improvements could be made to remove the duplication but this doesn't feel necessary so I overlooked it as part of this review.

Functionally, really just one question about NPEs (that also applies in other files, just only marked it in one place). Otherwise, great job in finding and implementing a solution here 🎉

Comment on lines +287 to +288
indexTemplate =
retryElasticsearchClient.getIndexTemplate(templateDescriptor.getTemplateName());
Copy link
Contributor

Choose a reason for hiding this comment

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

❓ Can this ever be null? It would NPE if so

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, it cannot be null because retryElasticsearchClient is used.
If the index template is not found for any reason, the client will retry until it becomes available, otherwise an exception will be thrown, if the max retries is reached,
This handles the edge case that can occur immediately after an index template is created, when some nodes may not yet return the template.

@houssain-barouni houssain-barouni added this pull request to the merge queue Aug 20, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 20, 2025
@houssain-barouni houssain-barouni added this pull request to the merge queue Aug 20, 2025
Merged via the queue into stable/8.7 with commit 58a2b84 Aug 20, 2025
92 of 98 checks passed
@houssain-barouni houssain-barouni deleted the hb-fix-32872 branch August 20, 2025 13:37
@backport-action
Copy link
Collaborator

github-merge-queue bot pushed a commit that referenced this pull request Aug 20, 2025
…S/OS configuration changes (#37007)

# Description
Backport of #36680 to `stable/8.6`.

relates to #32872
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport stable/8.6 Backport a pull request to stable/8.6 component/operate Related to the Operate component/team component/tasklist Related to the Tasklist component/team version:8.6.25
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use number_of_replicas and number_of_shards Elasticsearch configuration when it changes
3 participants