From c1e256976e9d85fcb1a676d504365aa5273a287d Mon Sep 17 00:00:00 2001 From: Joshua Palis Date: Wed, 6 Sep 2023 09:24:58 -0700 Subject: [PATCH] Setting JobSweeper search preference against primary shard (#483) * Setting sweepShard search request against primary shard Signed-off-by: Joshua Palis * testing primary first Signed-off-by: Joshua Palis * reverting back to primary Signed-off-by: Joshua Palis * setting fail fast to false Signed-off-by: Joshua Palis --------- Signed-off-by: Joshua Palis --- .github/workflows/ci.yml | 1 + .../java/org/opensearch/jobscheduler/sweeper/JobSweeper.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 745ce057..ddeabe35 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,7 @@ on: jobs: build: strategy: + fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] java: [11, 17] diff --git a/src/main/java/org/opensearch/jobscheduler/sweeper/JobSweeper.java b/src/main/java/org/opensearch/jobscheduler/sweeper/JobSweeper.java index 9fdcd0fa..e2bb077c 100644 --- a/src/main/java/org/opensearch/jobscheduler/sweeper/JobSweeper.java +++ b/src/main/java/org/opensearch/jobscheduler/sweeper/JobSweeper.java @@ -389,7 +389,7 @@ private void sweepShard(ShardId shardId, ShardNodes shardNodes, String startAfte String searchAfter = startAfter == null ? "" : startAfter; while (searchAfter != null) { SearchRequest jobSearchRequest = new SearchRequest().indices(shardId.getIndexName()) - .preference("_shards:" + shardId.id() + "|_only_local") + .preference("_shards:" + shardId.id() + "|_primary") .source( new SearchSourceBuilder().version(true) .seqNoAndPrimaryTerm(true)