Add Initial Routing and Metadata Groundwork for Virtual Shards#20745
Add Initial Routing and Metadata Groundwork for Virtual Shards#20745atris merged 6 commits intoopensearch-project:mainfrom
Conversation
PR Reviewer Guide 🔍(Review updated until commit d13a28c)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to d13a28c Explore these optional code suggestions:
Previous suggestionsSuggestions up to commit d13a28c
Suggestions up to commit d13a28c
Suggestions up to commit d188b49
Suggestions up to commit d188b49
Suggestions up to commit 679535f
|
|
❌ Gradle check result for 679535f: 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? |
PR Code Analyzer ❗AI-powered 'Code-Diff-Analyzer' found issues on commit 679535f.
The table above displays the top 10 most important findings. Pull Requests Author(s): Please update your Pull Request according to the report above. Repository Maintainer(s): You can Thanks. |
|
Persistent review updated to latest commit 679535f |
|
❌ Gradle check result for 679535f: 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? |
|
Persistent review updated to latest commit 679535f |
|
❌ Gradle check result for 679535f: 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? |
server/src/main/java/org/opensearch/cluster/metadata/VirtualShardRoutingHelper.java
Show resolved
Hide resolved
server/src/main/java/org/opensearch/cluster/metadata/VirtualShardRoutingHelper.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/cluster/metadata/VirtualShardRoutingHelper.java
Show resolved
Hide resolved
|
Persistent review updated to latest commit d188b49 |
|
❌ Gradle check result for d188b49: 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? |
|
Persistent review updated to latest commit d13a28c |
|
We also need to figure out a path for our upcoming CRs to see how virtual shards can work alongside shard split. |
|
❌ Gradle check result for d13a28c: 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? |
PR Code Analyzer ❗AI-powered 'Code-Diff-Analyzer' found issues on commit d13a28c.
The table above displays the top 10 most important findings. Pull Requests Author(s): Please update your Pull Request according to the report above. Repository Maintainer(s): You can Thanks. |
Thanks for sharing this. This PR has been open for ~2 weeks and is already approved, so let’s converge by stacking split changes on top of it instead of diverging Please rebase your split branch on this PR (or open it as a dependent PR) so we can review concrete deltas directly. I’ll review your split implementation and propose a concrete convergence plan covering routing invariants, behavior, and tests. Please also share your view of the convergence points you think are most critical so we can align quickly. |
|
Persistent review updated to latest commit d13a28c |
|
❌ Gradle check result for d13a28c: 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? |
|
Persistent review updated to latest commit d13a28c |
|
❌ Gradle check result for d13a28c: 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? |
|
@atris we can build the support of split on shard of the index consisting of virtual shards incrementally as this may require us to go through multiple components of OpenSearch architecture. For now, I think we can keep them exclusive to each other. An index having virtual shards will not allow a split and vice-versa. Once both virtual shard and shard split features are rolled out and we move them out of experimental phase, we can plan for converging them. Thoughts? |
…earch-project#20745) * Add Virtual Shards routing and mapping overrides Implements the initial routing foundation for Virtual Shards. Adds settings validation for virtual shards and routing overrides via IndexMetadata custom data. Signed-off-by: Atri Sharma <atri.jiit@gmail.com> * Add Virtual Shards routing and mapping overrides This PR adds the initial routing and metadata groundwork for virtual shards. When enabled, routing now uses a virtual shard id (vShardId) before resolving to a physical shard. This separates hash-space size from physical shard count and prepares the path for future shard movement workflows. What’s included - New static index setting: index.number_of_virtual_shards (default -1, disabled). - Routing update in OperationRouting.generateShardId: - virtual-shard path when enabled, - existing behavior unchanged when disabled. - New VirtualShardRoutingHelper for vShardId -> physical shard resolution. - Optional per-index override support via virtual_shards_routing custom metadata. - Test coverage for: - enabled/disabled routing behavior, - validation rules, - override and fallback behavior. Out of scope - Side-car segment extraction flow. - Transport/state-orchestration for managing override lifecycle. Signed-off-by: Atri Sharma <atri.jiit@gmail.com> * Add Virtual Shards routing and mapping overrides This PR adds the initial routing and metadata groundwork for virtual shards. When enabled, routing now uses a virtual shard id (vShardId) before resolving to a physical shard. This separates hash-space size from physical shard count and prepares the path for future shard movement workflows. What’s included - New static index setting: index.number_of_virtual_shards (default -1, disabled). - Routing update in OperationRouting.generateShardId: - virtual-shard path when enabled, - existing behavior unchanged when disabled. - New VirtualShardRoutingHelper for vShardId -> physical shard resolution. - Optional per-index override support via virtual_shards_routing custom metadata. - Test coverage for: - enabled/disabled routing behavior, - validation rules, - override and fallback behavior. Out of scope - Side-car segment extraction flow. - Transport/state-orchestration for managing override lifecycle. Signed-off-by: Atri Sharma <atri.jiit@gmail.com> * Refactor Virtual Shards to use range-based routing Signed-off-by: Atri Sharma <atri.jiit@gmail.com> * Add fail-safe to VirtualShardRoutingHelper and valid configuration tracking test Signed-off-by: Atri Sharma <atri.jiit@gmail.com> * Fixed review comments and move to range based sharding Signed-off-by: Atri Sharma <atri.jiit@gmail.com> --------- Signed-off-by: Atri Sharma <atri.jiit@gmail.com>
| } | ||
| logger.trace("Invalid override value [{}] for vShard [{}]: out of bounds", pShardId, vShardId); | ||
| } catch (NumberFormatException e) { | ||
| logger.trace("Invalid override value [{}] for vShard [{}]: not a number", pShardIdStr, vShardId); |
There was a problem hiding this comment.
why are we swallowing the exception?
| /** | ||
| * Resolves the physical shard for a virtual shard id. | ||
| */ | ||
| public static int resolvePhysicalShardId(IndexMetadata indexMetadata, int vShardId) { |
There was a problem hiding this comment.
what would be the access pattern, would it be called during the context of every request or cached?
This PR adds the initial routing and metadata groundwork for virtual shards.
When enabled, routing now uses a virtual shard id (vShardId) before resolving to a physical shard. This separates hash-space size from physical shard count and prepares the path for future shard movement workflows.
What's Included
Out of scope
Resolves #18809
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.