Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased 2.x]
### Added

- Renaming the node role search to warm ([#17573](https://github.com/opensearch-project/OpenSearch/pull/17573))
### Dependencies

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ private Map<String, Integer> getExpectedCounts(
expectedCounts.put(DiscoveryNodeRole.CLUSTER_MANAGER_ROLE.roleName(), clusterManagerRoleCount);
expectedCounts.put(DiscoveryNodeRole.INGEST_ROLE.roleName(), ingestRoleCount);
expectedCounts.put(DiscoveryNodeRole.REMOTE_CLUSTER_CLIENT_ROLE.roleName(), remoteClusterClientRoleCount);
expectedCounts.put(DiscoveryNodeRole.SEARCH_ROLE.roleName(), searchRoleCount);
expectedCounts.put(DiscoveryNodeRole.WARM_ROLE.roleName(), searchRoleCount);
expectedCounts.put(ClusterStatsNodes.Counts.COORDINATING_ONLY, coordinatingOnlyCount);
return expectedCounts;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public void testClusterInfoServiceCollectsInformation() {

final Map<String, FileCacheStats> nodeFileCacheStats = info.nodeFileCacheStats;
assertNotNull(nodeFileCacheStats);
assertThat("file cache is empty on non search nodes", nodeFileCacheStats.size(), Matchers.equalTo(0));
assertThat("file cache is empty on non warm nodes", nodeFileCacheStats.size(), Matchers.equalTo(0));

ClusterService clusterService = internalTestCluster.getInstance(ClusterService.class, internalTestCluster.getClusterManagerName());
ClusterState state = clusterService.state();
Expand All @@ -216,7 +216,7 @@ public void testClusterInfoServiceCollectsInformation() {

public void testClusterInfoServiceCollectsFileCacheInformation() {
internalCluster().startNodes(1);
internalCluster().ensureAtLeastNumSearchAndDataNodes(2);
internalCluster().ensureAtLeastNumWarmAndDataNodes(2);

InternalTestCluster internalTestCluster = internalCluster();
// Get the cluster info service on the cluster-manager node
Expand All @@ -229,7 +229,7 @@ public void testClusterInfoServiceCollectsFileCacheInformation() {
assertNotNull("info should not be null", info);
final Map<String, FileCacheStats> nodeFileCacheStats = info.nodeFileCacheStats;
assertNotNull(nodeFileCacheStats);
assertThat("file cache is enabled on both search nodes", nodeFileCacheStats.size(), Matchers.equalTo(2));
assertThat("file cache is enabled on both warm nodes", nodeFileCacheStats.size(), Matchers.equalTo(2));

for (FileCacheStats fileCacheStats : nodeFileCacheStats.values()) {
assertThat("file cache is non empty", fileCacheStats.getTotal().getBytes(), greaterThan(0L));
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void testWritableWarmFeatureFlagDisabled() {

InternalTestCluster internalTestCluster = internalCluster();
internalTestCluster.startClusterManagerOnlyNode(clusterSettings);
internalTestCluster.startDataAndSearchNodes(1);
internalTestCluster.startDataAndWarmNodes(1);

Settings indexSettings = Settings.builder()
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
Expand All @@ -109,7 +109,7 @@ public void testWritableWarmFeatureFlagDisabled() {
public void testWritableWarmBasic() throws Exception {
InternalTestCluster internalTestCluster = internalCluster();
internalTestCluster.startClusterManagerOnlyNode();
internalTestCluster.startDataAndSearchNodes(1);
internalTestCluster.startDataAndWarmNodes(1);
Settings settings = Settings.builder()
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -758,15 +758,15 @@ public BootstrapCheckResult check(BootstrapContext context) {
}

/**
* Bootstrap check that if a search node contains multiple data paths
* Bootstrap check that if a warm node contains multiple data paths
*/
static class MultipleDataPathCheck implements BootstrapCheck {

@Override
public BootstrapCheckResult check(BootstrapContext context) {
if (NodeRoleSettings.NODE_ROLES_SETTING.get(context.settings()).contains(DiscoveryNodeRole.SEARCH_ROLE)
if (NodeRoleSettings.NODE_ROLES_SETTING.get(context.settings()).contains(DiscoveryNodeRole.WARM_ROLE)
&& Environment.PATH_DATA_SETTING.get(context.settings()).size() > 1) {
return BootstrapCheckResult.failure("Multiple data paths are not allowed for search nodes");
return BootstrapCheckResult.failure("Multiple data paths are not allowed for warm nodes");
}
return BootstrapCheckResult.success();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ public void onResponse(NodesStatsResponse nodesStatsResponse) {
nodeFileCacheStats = Collections.unmodifiableMap(
nodesStatsResponse.getNodes()
.stream()
.filter(nodeStats -> nodeStats.getNode().isSearchNode())
.filter(nodeStats -> nodeStats.getNode().isWarmNode())
.collect(Collectors.toMap(nodeStats -> nodeStats.getNode().getId(), NodeStats::getFileCacheStats))
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ public static boolean isRemoteClusterClient(final Settings settings) {
return hasRole(settings, DiscoveryNodeRole.REMOTE_CLUSTER_CLIENT_ROLE);
}

public static boolean isSearchNode(Settings settings) {
return hasRole(settings, DiscoveryNodeRole.SEARCH_ROLE);
public static boolean isWarmNode(Settings settings) {
return hasRole(settings, DiscoveryNodeRole.WARM_ROLE);
}

public static boolean isDedicatedSearchNode(Settings settings) {
return getRolesFromSettings(settings).stream().allMatch(DiscoveryNodeRole.SEARCH_ROLE::equals);
public static boolean isDedicatedWarmNode(Settings settings) {
return getRolesFromSettings(settings).stream().allMatch(DiscoveryNodeRole.WARM_ROLE::equals);
}

private final String nodeName;
Expand Down Expand Up @@ -480,12 +480,12 @@ public boolean isRemoteClusterClient() {
}

/**
* Returns whether the node is dedicated to provide search capability.
* Returns whether the node is dedicated to hold warm indices.
*
* @return true if the node contains search role, false otherwise
* @return true if the node contains warm role, false otherwise
*/
public boolean isSearchNode() {
return roles.contains(DiscoveryNodeRole.SEARCH_ROLE);
public boolean isWarmNode() {
return roles.contains(DiscoveryNodeRole.WARM_ROLE);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,13 @@ public Setting<Boolean> legacySetting() {
};

/**
* Represents the role for a search node, which is dedicated to provide search capability.
* Represents the role for a warm node, which is dedicated to hold warm indices.
*/
public static final DiscoveryNodeRole SEARCH_ROLE = new DiscoveryNodeRole("search", "s", true) {
public static final DiscoveryNodeRole WARM_ROLE = new DiscoveryNodeRole("warm", "w", true) {

@Override
public Setting<Boolean> legacySetting() {
// search role is added in 2.4 so doesn't need to configure legacy setting
// warm role is added in 2.4 so doesn't need to configure legacy setting
return null;
}

Expand All @@ -314,7 +314,7 @@ public Setting<Boolean> legacySetting() {
* The built-in node roles.
*/
public static SortedSet<DiscoveryNodeRole> BUILT_IN_ROLES = Collections.unmodifiableSortedSet(
new TreeSet<>(Arrays.asList(DATA_ROLE, INGEST_ROLE, CLUSTER_MANAGER_ROLE, REMOTE_CLUSTER_CLIENT_ROLE, SEARCH_ROLE))
new TreeSet<>(Arrays.asList(DATA_ROLE, INGEST_ROLE, CLUSTER_MANAGER_ROLE, REMOTE_CLUSTER_CLIENT_ROLE, WARM_ROLE))
);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static RoutingPool getNodePool(RoutingNode 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()) {
if (node.isWarmNode()) {
return REMOTE_CAPABLE;
}
return LOCAL_ONLY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ public NodeEnvironment(Settings settings, Environment environment, IndexStoreLis
ensureNoShardData(nodePaths);
}

if (DiscoveryNode.isSearchNode(settings) == false) {
if (DiscoveryNode.isWarmNode(settings) == false) {
ensureNoFileCacheData(fileCacheNodePath);
}

Expand Down Expand Up @@ -1202,15 +1202,15 @@ private void ensureNoShardData(final NodePath[] nodePaths) throws IOException {
}

/**
* Throws an exception if cache exists on a non-search node.
* Throws an exception if cache exists on a non-warm node.
*/
private void ensureNoFileCacheData(final NodePath fileCacheNodePath) throws IOException {
List<Path> cacheDataPaths = collectFileCacheDataPath(fileCacheNodePath);
if (cacheDataPaths.isEmpty() == false) {
final String message = String.format(
Locale.ROOT,
"node does not have the %s role but has data within node search cache: %s. Use 'opensearch-node repurpose' tool to clean up",
DiscoveryNodeRole.SEARCH_ROLE.roleName(),
"node does not have the %s role but has data within node warm cache: %s. Use 'opensearch-node repurpose' tool to clean up",
DiscoveryNodeRole.WARM_ROLE.roleName(),
cacheDataPaths
);
throw new IllegalStateException(message);
Expand Down
30 changes: 15 additions & 15 deletions server/src/main/java/org/opensearch/env/NodeRepurposeCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ public class NodeRepurposeCommand extends OpenSearchNodeCommand {

static final String ABORTED_BY_USER_MSG = OpenSearchNodeCommand.ABORTED_BY_USER_MSG;
static final String FAILED_TO_OBTAIN_NODE_LOCK_MSG = OpenSearchNodeCommand.FAILED_TO_OBTAIN_NODE_LOCK_MSG;
static final String NO_CLEANUP = "Node has node.data=true and node.search=true -> no clean up necessary";
static final String NO_CLEANUP = "Node has node.data=true and node.warm=true -> no clean up necessary";
static final String NO_DATA_TO_CLEAN_UP_FOUND = "No data to clean-up found";
static final String NO_SHARD_DATA_TO_CLEAN_UP_FOUND = "No shard data to clean-up found";
static final String NO_FILE_CACHE_DATA_TO_CLEAN_UP_FOUND = "No file cache to clean-up found";
private static final int FILE_CACHE_NODE_PATH_LOCATION = 0;

public NodeRepurposeCommand() {
super("Repurpose this node to another cluster-manager/data/search role, cleaning up any excess persisted data");
super("Repurpose this node to another cluster-manager/data/warm role, cleaning up any excess persisted data");
}

void testExecute(Terminal terminal, OptionSet options, Environment env) throws Exception {
Expand All @@ -86,7 +86,7 @@ void testExecute(Terminal terminal, OptionSet options, Environment env) throws E
@Override
protected boolean validateBeforeLock(Terminal terminal, Environment env) {
Settings settings = env.settings();
if (DiscoveryNode.isDataNode(settings) && DiscoveryNode.isSearchNode(settings)) {
if (DiscoveryNode.isDataNode(settings) && DiscoveryNode.isWarmNode(settings)) {
terminal.println(Terminal.Verbosity.NORMAL, NO_CLEANUP);
return false;
}
Expand All @@ -97,15 +97,15 @@ protected boolean validateBeforeLock(Terminal terminal, Environment env) {
@Override
protected void processNodePaths(Terminal terminal, Path[] dataPaths, int nodeLockId, OptionSet options, Environment env)
throws IOException {
assert DiscoveryNode.isDataNode(env.settings()) == false || DiscoveryNode.isSearchNode(env.settings()) == false;
assert DiscoveryNode.isDataNode(env.settings()) == false || DiscoveryNode.isWarmNode(env.settings()) == false;

boolean repurposeData = DiscoveryNode.isDataNode(env.settings()) == false;
boolean repurposeSearch = DiscoveryNode.isSearchNode(env.settings()) == false;
boolean repurposeWarm = DiscoveryNode.isWarmNode(env.settings()) == false;

if (DiscoveryNode.isClusterManagerNode(env.settings()) == false) {
processNoClusterManagerRepurposeNode(terminal, dataPaths, env, repurposeData, repurposeSearch);
processNoClusterManagerRepurposeNode(terminal, dataPaths, env, repurposeData, repurposeWarm);
} else {
processClusterManagerRepurposeNode(terminal, dataPaths, env, repurposeData, repurposeSearch);
processClusterManagerRepurposeNode(terminal, dataPaths, env, repurposeData, repurposeWarm);
}
}

Expand Down Expand Up @@ -170,13 +170,13 @@ private void processNoClusterManagerRepurposeNode(

if (repurposeData && repurposeSearch) {
terminal.println(
"Node is being re-purposed as no-cluster-manager, no-data and no-search. Clean-up of index data and file cache will be performed."
"Node is being re-purposed as no-cluster-manager, no-data and no-warm. Clean-up of index data and file cache will be performed."
);
} else if (repurposeData) {
terminal.println("Node is being re-purposed as no-cluster-manager and no-data. Clean-up of index data will be performed.");
} else if (repurposeSearch) {
terminal.println(
"Node is being re-purposed as no-cluster-manager and no-search. Clean-up of file cache and corresponding index metadata will be performed."
"Node is being re-purposed as no-cluster-manager and no-warm. Clean-up of file cache and corresponding index metadata will be performed."
);
}
confirm(terminal, "Do you want to proceed?");
Expand All @@ -194,11 +194,11 @@ private void processNoClusterManagerRepurposeNode(
}

if (repurposeData && repurposeSearch) {
terminal.println("Node successfully repurposed to no-cluster-manager, no-data and no-search.");
terminal.println("Node successfully repurposed to no-cluster-manager, no-data and no-warm.");
} else if (repurposeData) {
terminal.println("Node successfully repurposed to no-cluster-manager and no-data.");
} else if (repurposeSearch) {
terminal.println("Node successfully repurposed to no-cluster-manager and no-search.");
terminal.println("Node successfully repurposed to no-cluster-manager and no-warm.");
}
}

Expand Down Expand Up @@ -252,12 +252,12 @@ private void processClusterManagerRepurposeNode(

if (repurposeData && repurposeSearch) {
terminal.println(
"Node is being re-purposed as cluster-manager, no-data and no-search. Clean-up of shard data and file cache data will be performed."
"Node is being re-purposed as cluster-manager, no-data and no-warm. Clean-up of shard data and file cache data will be performed."
);
} else if (repurposeData) {
terminal.println("Node is being re-purposed as cluster-manager and no-data. Clean-up of shard data will be performed.");
} else if (repurposeSearch) {
terminal.println("Node is being re-purposed as cluster-manager and no-search. Clean-up of file cache data will be performed.");
terminal.println("Node is being re-purposed as cluster-manager and no-warm. Clean-up of file cache data will be performed.");
}

confirm(terminal, "Do you want to proceed?");
Expand All @@ -271,11 +271,11 @@ private void processClusterManagerRepurposeNode(
}

if (repurposeData && repurposeSearch) {
terminal.println("Node successfully repurposed to cluster-manager, no-data and no-search.");
terminal.println("Node successfully repurposed to cluster-manager, no-data and no-warm.");
} else if (repurposeData) {
terminal.println("Node successfully repurposed to cluster-manager and no-data.");
} else if (repurposeSearch) {
terminal.println("Node successfully repurposed to cluster-manager and no-search.");
terminal.println("Node successfully repurposed to cluster-manager and no-warm.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static TieringValidationResult validateHotToWarm(
final DiskThresholdSettings diskThresholdSettings
) {
final String indexNames = concreteIndices.stream().map(Index::getName).collect(Collectors.joining(", "));
validateSearchNodes(currentState, indexNames);
validateWarmNodes(currentState, indexNames);
validateDiskThresholdWaterMarkNotBreached(currentState, clusterInfo, diskThresholdSettings, indexNames);

final TieringValidationResult tieringValidationResult = new TieringValidationResult(concreteIndices);
Expand Down Expand Up @@ -91,18 +91,18 @@ public static TieringValidationResult validateHotToWarm(
}

/**
* Validates that there are eligible nodes with the search role in the current cluster state.
* Validates that there are eligible nodes with the warm role in the current cluster state.
* (only for the dedicated case - to be removed later)
*
* @param currentState the current cluster state
* @param indexNames the names of the indices being validated
* @throws IllegalArgumentException if there are no eligible search nodes in the cluster
* @throws IllegalArgumentException if there are no eligible warm nodes in the cluster
*/
static void validateSearchNodes(final ClusterState currentState, final String indexNames) {
static void validateWarmNodes(final ClusterState currentState, final String indexNames) {
if (getEligibleNodes(currentState).isEmpty()) {
final String errorMsg = "Rejecting tiering request for indices ["
+ indexNames
+ "] because there are no nodes found with the search role";
+ "] because there are no nodes found with the warm role";
logger.warn(errorMsg);
throw new IllegalArgumentException(errorMsg);
}
Expand Down Expand Up @@ -183,7 +183,7 @@ static void validateDiskThresholdWaterMarkNotBreached(
}
}
throw new IllegalArgumentException(
"Disk threshold low watermark is breached on all the search nodes, rejecting tiering request for indices: " + indexNames
"Disk threshold low watermark is breached on all the warm nodes, rejecting tiering request for indices: " + indexNames
);
}

Expand Down Expand Up @@ -265,13 +265,13 @@ static long getTotalAvailableBytesInWarmTier(final Map<String, DiskUsage> usages
}

/**
* Retrieves the set of eligible(search) nodes from the current cluster state.
* Retrieves the set of eligible(warm) nodes from the current cluster state.
*
* @param currentState the current cluster state
* @return the set of eligible nodes
*/
static Set<DiscoveryNode> getEligibleNodes(final ClusterState currentState) {
final Map<String, DiscoveryNode> nodes = currentState.getNodes().getDataNodes();
return nodes.values().stream().filter(DiscoveryNode::isSearchNode).collect(Collectors.toSet());
return nodes.values().stream().filter(DiscoveryNode::isWarmNode).collect(Collectors.toSet());
}
}
Loading
Loading