Ensure that the refresh has ran on all shards.
Original commit: elastic/x-pack-elasticsearch@6214514956
This commit is contained in:
parent
a7e85df649
commit
df7fc714e7
|
@ -198,7 +198,7 @@ public class AlertsStore extends AbstractComponent {
|
|||
private void loadAlerts() {
|
||||
assert alertMap.isEmpty() : "No alerts should reside, but there are " + alertMap.size() + " alerts.";
|
||||
RefreshResponse refreshResponse = client.admin().indices().refresh(new RefreshRequest(ALERT_INDEX)).actionGet();
|
||||
if (refreshResponse.getSuccessfulShards() != refreshResponse.getSuccessfulShards()) {
|
||||
if (refreshResponse.getTotalShards() != refreshResponse.getSuccessfulShards()) {
|
||||
throw new ElasticsearchException("Not all shards have been refreshed");
|
||||
}
|
||||
|
||||
|
|
|
@ -165,10 +165,10 @@ public class AlertActionManager extends AbstractComponent {
|
|||
return ALERT_HISTORY_INDEX_PREFIX + alertHistoryIndexTimeFormat.print(time);
|
||||
}
|
||||
|
||||
public void loadQueue() {
|
||||
private void loadQueue() {
|
||||
assert actionsToBeProcessed.isEmpty() : "Queue should be empty, but contains " + actionsToBeProcessed.size() + " elements.";
|
||||
RefreshResponse refreshResponse = client.admin().indices().refresh(new RefreshRequest(ALERT_HISTORY_INDEX_PREFIX + "*")).actionGet();
|
||||
if (refreshResponse.getSuccessfulShards() != refreshResponse.getSuccessfulShards()) {
|
||||
if (refreshResponse.getTotalShards() != refreshResponse.getSuccessfulShards()) {
|
||||
throw new ElasticsearchException("Not all shards have been refreshed");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue