Skip to content

Commit

Permalink
Add _primary preference only for segment replication enabled indices (#…
Browse files Browse the repository at this point in the history
…2040)

* Add _primary preference only for segment replication enabled indices

Signed-off-by: Suraj Singh <[email protected]>

* Add test for segment replication tests

Signed-off-by: Suraj Singh <[email protected]>

* Remove isSegRepEnabled check and use _primary_first preference

Signed-off-by: Suraj Singh <[email protected]>

* Remove unused ClusterState reference

Signed-off-by: Suraj Singh <[email protected]>

* Self review

Signed-off-by: Suraj Singh <[email protected]>

---------

Signed-off-by: Suraj Singh <[email protected]>
  • Loading branch information
dreamer-89 authored Sep 1, 2023
1 parent 5903e6c commit 9c12628
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ private List<DataSourceMetadata> searchInDataSourcesIndex(QueryBuilder query) {
searchSourceBuilder.query(query);
searchSourceBuilder.size(DATASOURCE_QUERY_RESULT_SIZE);
searchRequest.source(searchSourceBuilder);
// https://github.com/opensearch-project/sql/issues/1801.
searchRequest.preference("_primary_first");
ActionFuture<SearchResponse> searchResponseActionFuture;
try (ThreadContext.StoredContext ignored =
client.threadPool().getThreadContext().stashContext()) {
Expand Down

0 comments on commit 9c12628

Please sign in to comment.