Skip to content

Commit

Permalink
Throws IndexNotFoundException in TransportGetAction for unknown Syste…
Browse files Browse the repository at this point in the history
…m indices (#61785) (#61791)

The change #57936 introduced a dedicated thread pool for reads in system indices. 
It also introduced a potential NPE in the case the index to read in not yet present in 
the cluster state. This commit fixes that bug by using the getIndexSafe() instead of 
just index() method when retrieving the index's metadata so that an INFE is thrown 
if the index does not exist.
  • Loading branch information
tlrx committed Sep 1, 2020
1 parent 2547cfb commit 6e944d9
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ protected Writeable.Reader<GetResponse> getResponseReader() {
@Override
protected String getExecutor(GetRequest request, ShardId shardId) {
final ClusterState clusterState = clusterService.state();
if (clusterState.metadata().index(shardId.getIndex()).isSystem()) {
if (clusterState.metadata().getIndexSafe(shardId.getIndex()).isSystem()) {
return ThreadPool.Names.SYSTEM_READ;
} else if (indicesService.indexServiceSafe(shardId.getIndex()).getIndexSettings().isSearchThrottled()) {
return ThreadPool.Names.SEARCH_THROTTLED;
Expand Down

0 comments on commit 6e944d9

Please sign in to comment.