-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add remote allocator for searchable snapshots
Signed-off-by: Kunal Kotwani <kkotwani@amazon.com> Part of this commit was developed from code and concepts initially implemented in Amazon OpenSearch Service as part of the UltraWarm feature. Thank you to the following developers and the entire UltraWarm team. Co-authored-by: Min Zhou <minzho@amazon.com> Co-authored-by: Ankit Malpani <malpani@amazon.com> Co-authored-by: Rohit Nair <rohinair@amazon.com> Co-authored-by: Sorabh Hamirwasia <hsorabh@amazon.com> Co-authored-by: Ankit Jain <akjain@amazon.com> Co-authored-by: Tianru Zhou <tianruz@amazon.com> Co-authored-by: Neetika Singhal <neetiks@amazon.com> Co-authored-by: Amit Khandelwal <mkhnde@amazon.com> Co-authored-by: Vigya Sharma <vigyas@amazon.com> Co-authored-by: Prateek Sharma <shrprat@amazon.com> Co-authored-by: Venkata Jyothsna Donapati <donapv@amazon.com> Co-authored-by: Vlad Rozov <vrozov@amazon.com> Co-authored-by: Mohit Agrawal <agramohi@amazon.com> Co-authored-by: Shweta Thareja <tharejas@amazon.com> Co-authored-by: Palash Hedau <phhedau@amazon.com> Co-authored-by: Saurabh Singh <sisurab@amazon.com> Co-authored-by: Piyush Daftary <pdaftary@amazon.com> Co-authored-by: Payal Maheshwari <pmaheshw@amazon.com> Co-authored-by: Kunal Khatua <kkhatua@amazon.com> Co-authored-by: Gulshan Kumar <kumargu@amazon.com> Co-authored-by: Rushi Agrawal <agrrushi@amazon.com> Co-authored-by: Ketan Verma <vermketa@amazon.com> Co-authored-by: Gaurav Chandani <chngau@amazon.com> Co-authored-by: Dharmesh Singh <sdharms@amazon.com> Signed-off-by: Kunal Kotwani <kkotwani@amazon.com>
- Loading branch information
1 parent
f0aed87
commit 694c89f
Showing
20 changed files
with
1,783 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
server/src/main/java/org/opensearch/cluster/routing/RoutingPool.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.cluster.routing; | ||
|
||
import org.opensearch.cluster.metadata.IndexMetadata; | ||
import org.opensearch.cluster.node.DiscoveryNode; | ||
import org.opensearch.cluster.routing.allocation.RoutingAllocation; | ||
import org.opensearch.common.settings.Settings; | ||
import org.opensearch.index.IndexModule; | ||
|
||
/** | ||
* {@link RoutingPool} defines the different node types based on the assigned capabilities. The methods | ||
* help decide the capabilities of a specific node as well as an index or shard based on the index configuration. | ||
* These methods help with allocation decisions and determining shard classification with the allocation process. | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public enum RoutingPool { | ||
LOCAL_ONLY, | ||
REMOTE_CAPABLE; | ||
|
||
/** | ||
* Helps to determine the appropriate {@link RoutingPool} for a given node from the {@link RoutingNode} | ||
*/ | ||
public static RoutingPool getNodePool(RoutingNode node) { | ||
return getNodePool(node.node()); | ||
} | ||
|
||
/** | ||
* Helps to determine the appropriate {@link RoutingPool} for a given node from the {@link DiscoveryNode} | ||
*/ | ||
public static RoutingPool getNodePool(DiscoveryNode node) { | ||
if (node.isSearchNode()) { | ||
return REMOTE_CAPABLE; | ||
} | ||
return LOCAL_ONLY; | ||
} | ||
|
||
/** | ||
* Can determine the appropriate {@link RoutingPool} for a given shard using the {@link IndexMetadata} for the | ||
* index using the {@link RoutingAllocation}. | ||
* @param shard the shard routing for which {@link RoutingPool} has to be determined. | ||
* @param allocation the current allocation of the cluster | ||
* @return {@link RoutingPool} for the given shard. | ||
*/ | ||
public static RoutingPool getShardPool(ShardRouting shard, RoutingAllocation allocation) { | ||
IndexMetadata indexMetadata = allocation.metadata().getIndexSafe(shard.index()); | ||
return getIndexPool(indexMetadata); | ||
} | ||
|
||
/** | ||
* Can determine the appropriate {@link RoutingPool} for a given index using the {@link IndexMetadata}. | ||
* @param indexMetadata the index metadata object for which {@link RoutingPool} has to be determined. | ||
* @return {@link RoutingPool} for the given index. | ||
*/ | ||
public static RoutingPool getIndexPool(IndexMetadata indexMetadata) { | ||
Settings indexSettings = indexMetadata.getSettings(); | ||
if (IndexModule.Type.REMOTE_SNAPSHOT.getSettingsKey().equals(indexSettings.get(IndexModule.INDEX_STORE_TYPE_SETTING.getKey()))) { | ||
return REMOTE_CAPABLE; | ||
} | ||
return LOCAL_ONLY; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.