Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.message.ParameterizedMessage;
import org.apache.lucene.store.AlreadyClosedException;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
Expand Down Expand Up @@ -302,9 +303,21 @@ private void fetchFollowerShardInfo(
if (filteredShardStats.isPresent()) {
final ShardStats shardStats = filteredShardStats.get();
final CommitStats commitStats = shardStats.getCommitStats();
final String historyUUID = commitStats.getUserData().get(Engine.HISTORY_UUID_KEY);

if (commitStats == null) {
// If commitStats is null then AlreadyClosedException has been thrown: TransportIndicesStatsAction#shardOperation(...)
// AlreadyClosedException will be retried byShardFollowNodeTask.shouldRetry(...)
errorHandler.accept(new AlreadyClosedException(shardId + " commit_stats are missing"));
return;
}
final SeqNoStats seqNoStats = shardStats.getSeqNoStats();
if (seqNoStats == null) {
// If seqNoStats is null then AlreadyClosedException has been thrown at TransportIndicesStatsAction#shardOperation(...)
// AlreadyClosedException will be retried byShardFollowNodeTask.shouldRetry(...)
errorHandler.accept(new AlreadyClosedException(shardId + " seq_no_stats are missing"));
return;
}

final String historyUUID = commitStats.getUserData().get(Engine.HISTORY_UUID_KEY);
final long globalCheckpoint = seqNoStats.getGlobalCheckpoint();
final long maxSeqNo = seqNoStats.getMaxSeqNo();
handler.accept(historyUUID, globalCheckpoint, maxSeqNo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ public void testFollowStatsApiResourceNotFound() throws Exception {
assertAcked(client().execute(PauseFollowAction.INSTANCE, new PauseFollowAction.Request("follower1")).actionGet());
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/38779")
public void testFollowStatsApiIncludeShardFollowStatsWithRemovedFollowerIndex() throws Exception {
final String leaderIndexSettings = getIndexSettings(1, 0,
singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true"));
Expand Down