Skip to content

Commit

Permalink
Guarantee datasource read api is strong consistent read (#1815)
Browse files Browse the repository at this point in the history
Signed-off-by: Peng Huo <penghuo@gmail.com>
(cherry picked from commit f38ffed)
  • Loading branch information
penghuo authored and github-actions[bot] committed Jul 10, 2023
1 parent fa82bae commit dc83782
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 dc83782

Please sign in to comment.