Ensure that the refresh has ran on all shards.

Original commit: elastic/x-pack-elasticsearch@6214514956
This commit is contained in:
Martijn van Groningen 2014-12-23 16:30:04 +01:00
parent a7e85df649
commit df7fc714e7
2 changed files with 3 additions and 3 deletions

View File

@ -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");
}

View File

@ -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");
}