Skip to content

Commit

Permalink
Flush API: remove refresh flag
Browse files Browse the repository at this point in the history
Refresh flag in flush is problematic, since the shards refresh is allowed to execute on is different compared to the flush shards. In order to do flush and then refresh, they should be executed as separate APIs when needed.
closes #3689
  • Loading branch information
kimchy committed Sep 13, 2013
1 parent 7bd8efd commit e947979
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 93 deletions.
Expand Up @@ -54,7 +54,6 @@
import org.elasticsearch.indices.IndexAlreadyExistsException;
import org.elasticsearch.indices.IndexMissingException;
import org.elasticsearch.indices.IndexTemplateMissingException;
import org.elasticsearch.rest.RestStatus;
import org.junit.*;

import java.io.IOException;
Expand Down Expand Up @@ -299,7 +298,7 @@ protected IndexResponse index(String index, String type, XContentBuilder source)
protected IndexResponse index(String index, String type, String id, Map<String, Object> source) {
return client().prepareIndex(index, type, id).setSource(source).execute().actionGet();
}

protected GetResponse get(String index, String type, String id) {
return client().prepareGet(index, type, id).execute().actionGet();
}
Expand Down Expand Up @@ -334,7 +333,9 @@ protected FlushResponse flush(boolean ignoreNotAllowed) {
FlushResponse actionGet = client().admin().indices().prepareFlush().execute().actionGet();
if (ignoreNotAllowed) {
for (ShardOperationFailedException failure : actionGet.getShardFailures()) {
assertThat("unexpected flush failure " + failure.reason(), failure.status(), equalTo(RestStatus.SERVICE_UNAVAILABLE));
if (!failure.reason().contains("FlushNotAllowed")) {
assert false : "unexpected failed flush " + failure.reason();
}
}
} else {
assertNoFailures(actionGet);
Expand Down

0 comments on commit e947979

Please sign in to comment.