Skip to content

Commit

Permalink
Guarantee datasource read api is strong consistent read (opensearch-p…
Browse files Browse the repository at this point in the history
…roject#1815)

Signed-off-by: Peng Huo <[email protected]>
  • Loading branch information
penghuo authored Jul 10, 2023
1 parent 41f3405 commit f38ffed
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ private List<DataSourceMetadata> searchInDataSourcesIndex(QueryBuilder query) {
searchSourceBuilder.query(query);
searchSourceBuilder.size(DATASOURCE_QUERY_RESULT_SIZE);
searchRequest.source(searchSourceBuilder);
// strongly consistent reads is requred. more info https://github.com/opensearch-project/sql/issues/1801.
searchRequest.preference("_primary");
ActionFuture<SearchResponse> searchResponseActionFuture;
try (ThreadContext.StoredContext ignored = client.threadPool().getThreadContext()
.stashContext()) {
Expand Down Expand Up @@ -305,4 +307,4 @@ private void handleSigV4PropertiesEncryptionDecryption(Map<String, String> prope
encryptOrDecrypt(propertiesMap, isEncryption, list);
}

}
}

0 comments on commit f38ffed

Please sign in to comment.