Skip to content

Commit 8fe8dcf

Browse files
committed
fixed PR comments
Signed-off-by: Vinay Krishna Pudyodu <vinkrish.neo@gmail.com>
1 parent 7d5ab5a commit 8fe8dcf

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

server/src/main/java/org/opensearch/cluster/node/DiscoveryNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public class DiscoveryNode implements VerifiableWriteable, ToXContentFragment {
7777

7878
static final String COORDINATING_ONLY = "coordinating_only";
7979

80-
static final String SEARCH_ONLY = "searchonly";
80+
static final String SEARCH_ONLY = "search_only";
8181

8282
public static boolean nodeRequiresLocalStorage(Settings settings) {
8383
boolean localStorageEnable = Node.NODE_LOCAL_STORAGE_SETTING.get(settings);

server/src/main/java/org/opensearch/cluster/routing/allocation/decider/SearchReplicaAllocationDecider.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,18 @@ public Decision canRemain(ShardRouting shardRouting, RoutingNode node, RoutingAl
3535
private Decision canAllocate(ShardRouting shardRouting, DiscoveryNode node, RoutingAllocation allocation) {
3636
boolean isSearchReplica = shardRouting.isSearchOnly();
3737

38-
if (node.isSearchDedicatedDataNode() && isSearchReplica) {
39-
return allocation.decision(Decision.YES, NAME, "node is search dedicated data node and shard is search replica");
40-
} else if (!node.isSearchDedicatedDataNode() && !isSearchReplica) {
41-
return allocation.decision(Decision.YES, NAME, "node is not search dedicated data node and shard is replica");
42-
} else if (node.isSearchDedicatedDataNode() && !isSearchReplica) {
43-
return allocation.decision(Decision.NO, NAME, "Node is a search dedicated data node but shard is not a search replica");
38+
if (node.isSearchDedicatedDataNode()) {
39+
if (isSearchReplica) {
40+
return allocation.decision(Decision.YES, NAME, "node is search dedicated data node and shard is search replica");
41+
} else {
42+
return allocation.decision(Decision.NO, NAME, "Node is a search dedicated data node but shard is not a search replica");
43+
}
4444
} else {
45-
return allocation.decision(Decision.NO, NAME, "Node is not a search dedicated data node but shard is a search replica");
45+
if (isSearchReplica) {
46+
return allocation.decision(Decision.NO, NAME, "Node is not a search dedicated data node but shard is a search replica");
47+
} else {
48+
return allocation.decision(Decision.YES, NAME, "node is not search dedicated data node and shard is not a search replica");
49+
}
4650
}
4751
}
4852
}

0 commit comments

Comments
 (0)