|
8 | 8 | import org.apache.logging.log4j.LogManager;
|
9 | 9 | import org.apache.logging.log4j.Logger;
|
10 | 10 | import org.apache.logging.log4j.message.ParameterizedMessage;
|
| 11 | +import org.apache.lucene.store.AlreadyClosedException; |
11 | 12 | import org.elasticsearch.action.ActionListener;
|
12 | 13 | import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
|
13 | 14 | import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
|
@@ -302,9 +303,21 @@ private void fetchFollowerShardInfo(
|
302 | 303 | if (filteredShardStats.isPresent()) {
|
303 | 304 | final ShardStats shardStats = filteredShardStats.get();
|
304 | 305 | final CommitStats commitStats = shardStats.getCommitStats();
|
305 |
| - final String historyUUID = commitStats.getUserData().get(Engine.HISTORY_UUID_KEY); |
306 |
| - |
| 306 | + if (commitStats == null) { |
| 307 | + // If commitStats is null then AlreadyClosedException has been thrown: TransportIndicesStatsAction#shardOperation(...) |
| 308 | + // AlreadyClosedException will be retried byShardFollowNodeTask.shouldRetry(...) |
| 309 | + errorHandler.accept(new AlreadyClosedException(shardId + " commit_stats are missing")); |
| 310 | + return; |
| 311 | + } |
307 | 312 | final SeqNoStats seqNoStats = shardStats.getSeqNoStats();
|
| 313 | + if (seqNoStats == null) { |
| 314 | + // If seqNoStats is null then AlreadyClosedException has been thrown at TransportIndicesStatsAction#shardOperation(...) |
| 315 | + // AlreadyClosedException will be retried byShardFollowNodeTask.shouldRetry(...) |
| 316 | + errorHandler.accept(new AlreadyClosedException(shardId + " seq_no_stats are missing")); |
| 317 | + return; |
| 318 | + } |
| 319 | + |
| 320 | + final String historyUUID = commitStats.getUserData().get(Engine.HISTORY_UUID_KEY); |
308 | 321 | final long globalCheckpoint = seqNoStats.getGlobalCheckpoint();
|
309 | 322 | final long maxSeqNo = seqNoStats.getMaxSeqNo();
|
310 | 323 | handler.accept(historyUUID, globalCheckpoint, maxSeqNo);
|
|
0 commit comments