Be more lenient in EIT#waitForDocs
The count request now acts like search and barfs if all shards fail this behavior changed and some tests like RecoveryWhileUnderLoadTests relied on the lenient behavior of the old count API. This might be a temporary solution to stop current test failures. Relates to #11198
This commit is contained in:
parent
6c81a8daf3
commit
fcccd45601
|
@ -1067,12 +1067,17 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
|
|||
lastKnownCount.set(indexer.totalIndexedDocs());
|
||||
}
|
||||
if (lastKnownCount.get() >= numDocs) {
|
||||
long count = client().prepareCount().setQuery(matchAllQuery()).execute().actionGet().getCount();
|
||||
if (count == lastKnownCount.get()) {
|
||||
// no progress - try to refresh for the next time
|
||||
client().admin().indices().prepareRefresh().get();
|
||||
try {
|
||||
long count = client().prepareCount().setQuery(matchAllQuery()).execute().actionGet().getCount();
|
||||
if (count == lastKnownCount.get()) {
|
||||
// no progress - try to refresh for the next time
|
||||
client().admin().indices().prepareRefresh().get();
|
||||
}
|
||||
lastKnownCount.set(count);
|
||||
} catch (Throwable e) { // count now acts like search and barfs if all shards failed...
|
||||
logger.debug("failed to executed count", e);
|
||||
return false;
|
||||
}
|
||||
lastKnownCount.set(count);
|
||||
logger.debug("[{}] docs visible for search. waiting for [{}]", lastKnownCount.get(), numDocs);
|
||||
} else {
|
||||
logger.debug("[{}] docs indexed. waiting for [{}]", lastKnownCount.get(), numDocs);
|
||||
|
|
Loading…
Reference in New Issue