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

Disable auto-expand functionality for stateless indices #108797

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

javanna
Copy link
Member

@javanna javanna commented May 17, 2024

Replicas are automatically managed in stateless, this commit disabled auto-expand replicas for stateless indices. As a result, stateless indices won't see auto-expand take any effect. Such indices will have their replicas auto-managed like any other index.

Note: the auto-expand functionality is already disabled for stateless indices, by always returning 1 as desired number of replicas. What this PR does is skipping stateless indices entirely, so that we don't make any decision around auto-expanding, instead of forcing 1. The end result will be the same in terms of number of replicas, because 0 will be rewritten to 1 anyways, but values that differ from 0 will be left as-is instead of rewritten to 1 at all times.

Replicas are automatically managed in stateless, hence auto-expand replicas needs to be disabled for stateless indices in order
for it not to conflict with the automatic management of replicas for indices.
As a result, stateless indices won't see auto-expand take any effect due to applying auto-expand replicas from the ES codebase.
There is an edge-case for indices that do set number of replicas to 0 manually as well as auto_expand_replicas as part of
index settings: in that case we force such value to be 1 rather than 0.
@javanna javanna force-pushed the enhancement/disable_auto_expand_stateless branch from 7cebdc8 to 35da6d5 Compare May 24, 2024 07:50
@javanna javanna added :Distributed/Distributed A catch all label for anything in the Distributed Area. If you aren't sure, use this one. >non-issue labels May 24, 2024
@javanna javanna marked this pull request as ready for review May 24, 2024 09:23
indexMetadata.getSettings().get(ExistingShardsAllocator.EXISTING_SHARDS_ALLOCATOR_SETTING.getKey()),
"stateless"
)) {
if (indexMetadata.getNumberOfReplicas() == 0) {
Copy link
Member Author

Choose a reason for hiding this comment

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

I opened #108994 to at least partially address this situation, where we create indices providing auto_expand_replicas config as well as number_of_replicas, but that won't cover all cases. There's one case of the enrich index that gets created with number of replicas set to 0, and only later updated to get auto expanded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed/Distributed A catch all label for anything in the Distributed Area. If you aren't sure, use this one. >non-issue test-update-serverless v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants