Skip to content

Commit 21fa7f6

Browse files
committed
Use isSearchable instead of checking if a shard can be promoted.
1 parent 9be73c5 commit 21fa7f6

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

x-pack/plugin/downsample/src/main/java/org/elasticsearch/xpack/downsample/DownsampleShardPersistentTaskExecutor.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,10 @@ public PersistentTasksCustomMetadata.Assignment getAssignment(
161161

162162
/**
163163
* Only shards that can be searched can be used as the source of a downsampling task.
164-
* In stateless deployment, this means that shards that CANNOT be promoted to primary can be used.
165164
* For simplicity, in non-stateless deployments we use the primary shard.
166165
*/
167166
private boolean isEligible(ShardRouting shardRouting) {
168-
return shardRouting.started() && (isStateless ? shardRouting.isPromotableToPrimary() == false : shardRouting.primary());
167+
return shardRouting.started() && (isStateless ? shardRouting.isSearchable() : shardRouting.primary());
169168
}
170169

171170
private boolean isCandidateNode(Collection<DiscoveryNode> candidateNodes, String nodeId) {

0 commit comments

Comments
 (0)