-
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>
- Loading branch information
1 parent
515f84b
commit 57ac40e
Showing
19 changed files
with
1,593 additions
and
7 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
44 changes: 44 additions & 0 deletions
44
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,44 @@ | ||
/* | ||
* 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; | ||
|
||
public enum RoutingPool { | ||
LOCAL_ONLY, | ||
REMOTE_CAPABLE; | ||
|
||
public static RoutingPool getNodePool(RoutingNode node) { | ||
return getNodePool(node.node()); | ||
} | ||
|
||
public static RoutingPool getNodePool(DiscoveryNode node) { | ||
if (node.isSearchNode()) { | ||
return REMOTE_CAPABLE; | ||
} | ||
return LOCAL_ONLY; | ||
} | ||
|
||
public static RoutingPool getShardPool(ShardRouting shard, RoutingAllocation allocation) { | ||
IndexMetadata indexMetadata = allocation.metadata().getIndexSafe(shard.index()); | ||
return getIndexPool(indexMetadata); | ||
} | ||
|
||
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.