Throws IndexNotFoundException in TransportGetAction for unknown System 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.
This commit is contained in:
Tanguy Leroux 2020-09-01 17:41:57 +02:00 committed by GitHub
parent 2547cfbe54
commit 6e944d9e21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -116,7 +116,7 @@ public class TransportGetAction extends TransportSingleShardAction<GetRequest, G
@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;