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

Adding number of routing shards to index settings before passing into… #14446

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

Conversation

PeacefulTortoise
Copy link

@PeacefulTortoise PeacefulTortoise commented Jun 19, 2024

… GetSettingsResponse

Description

Adds number_of_routing_shards into indexSettings before passing into GetSettingsResponse. Alternative solution to PR-4443.

Related Issues

Resolves #14199

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@PeacefulTortoise PeacefulTortoise force-pushed the bug-14199-fix-2 branch 3 times, most recently from ede87d5 to fa27c83 Compare June 19, 2024 03:25
@github-actions github-actions bot added bug Something isn't working good first issue Good for newcomers Indexing Indexing, Bulk Indexing and anything related to indexing labels Jun 19, 2024
Copy link
Contributor

❌ Gradle check result for 950f0ad: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for 82a9f3c: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for ede87d5: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for fa27c83: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@PeacefulTortoise PeacefulTortoise force-pushed the bug-14199-fix-2 branch 2 times, most recently from dcfe9d7 to 6e32fb5 Compare June 19, 2024 20:06
Copy link
Contributor

❌ Gradle check result for 42f9754: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for dcfe9d7: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for 6e32fb5: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Collaborator

@Bukhtawar Bukhtawar left a comment

Choose a reason for hiding this comment

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

Do you intent to backport to 2.x, if yes please handle BWC

Copy link
Contributor

❌ Gradle check result for 013105b: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for 1b12a69: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@PeacefulTortoise PeacefulTortoise force-pushed the bug-14199-fix-2 branch 2 times, most recently from 240d42d to 1f865f4 Compare June 21, 2024 17:32
Copy link
Contributor

❌ Gradle check result for 240d42d: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for 1f865f4: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

… GetSettingsResponse

Signed-off-by: Sophia <tjdud6024@gmail.com>
Copy link
Contributor

✅ Gradle check result for c14ce22: SUCCESS

Copy link
Contributor

✅ Gradle check result for 02bd802: SUCCESS

@gaobinlong
Copy link
Contributor

I have a concern that we always return the setting index.number_of_routing_shards when calling get index settings API, that setting is not commonly used(may only useful when splitting index), should we only show the setting when it was set explicitly? What do you think about this? @Bukhtawar @r1walz @reta @andrross

@reta
Copy link
Collaborator

reta commented Jun 26, 2024

I have a concern that we always return the setting index.number_of_routing_shards when calling get index settings API, that setting is not commonly used(may only useful when splitting index), should we only show the setting when it was set explicitly? What do you think about this? @Bukhtawar @r1walz @reta @andrross

Thanks @gaobinlong , I think this is very valid concern. This settings is only useful during the Resize API calls (and could be created temporarily for the index in question), it is not a regular index setting per se.

@r1walz
Copy link
Member

r1walz commented Jun 26, 2024

I have a concern that we always return the setting index.number_of_routing_shards when calling get index settings API, that setting is not commonly used(may only useful when splitting index), should we only show the setting when it was set explicitly? What do you think about this? @Bukhtawar @r1walz @reta @andrross

It sounds like a better idea to only return the setting when explicitly set by the user. I think we can make this distinction by pushing the setting into the IndexMetadata#settings variable when it is provided by the user (passed into request while creating index or copied from sourceMetadata in case of resize action, etc). All settings pushed into IndexMetadata#settings are visible in the response of GET {index}/_settings call unless filtered.

Side Note: while looking into the issue, I found that INDEX_NUMBER_OF_ROUTING_SHARDS_SETTING is only IndexScope settings while it should also be a Final settings as well because routing number of shards is also used during routing of docs in OperationRouting, it should not change after index creation

return Math.floorMod(hash, indexMetadata.getRoutingNumShards()) / indexMetadata.getRoutingFactor();

IndexScope settings can be updated when index is closed. Although, it's value is never read from the settings itself during operation routing. But, it created yet another discrepancy between these two variables representing same information (eg: in _cluster/state call).

@PeacefulTortoise
Copy link
Author

I have a concern that we always return the setting index.number_of_routing_shards when calling get index settings API, that setting is not commonly used(may only useful when splitting index), should we only show the setting when it was set explicitly? What do you think about this? @Bukhtawar @r1walz @reta @andrross

It sounds like a better idea to only return the setting when explicitly set by the user. I think we can make this distinction by pushing the setting into the IndexMetadata#settings variable when it is provided by the user (passed into request while creating index or copied from sourceMetadata in case of resize action, etc). All settings pushed into IndexMetadata#settings are visible in the response of GET {index}/_settings call unless filtered.

Side Note: while looking into the issue, I found that INDEX_NUMBER_OF_ROUTING_SHARDS_SETTING is only IndexScope settings while it should also be a Final settings as well because routing number of shards is also used during routing of docs in OperationRouting, it should not change after index creation

return Math.floorMod(hash, indexMetadata.getRoutingNumShards()) / indexMetadata.getRoutingFactor();

IndexScope settings can be updated when index is closed. Although, it's value is never read from the settings itself during operation routing. But, it created yet another discrepancy between these two variables representing same information (eg: in _cluster/state call).

Hello! If I understand what you're saying correctly, I think what you're suggesting is similar to the approach that I initially implemented . I think the issue is that there seems to be a deliberate removal of the number_of_routing_shards in IndexMetadata on creation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers Indexing Indexing, Bulk Indexing and anything related to indexing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] GET {index}/_settings does not list number_of_routing_shards as setting
5 participants