Added @TestLogging to all methods to see which shards we refresh and which ones we search on

Increased wait timeout and added multiple iterations there as well, one is not enough. We want to verify whether the problem gets fixed later on.
This commit is contained in:
Luca Cavanna 2013-09-21 20:08:55 +02:00
parent 953bbe4291
commit b28c82a1e6

View File

@ -131,7 +131,7 @@ public class RecoveryWhileUnderLoadTests extends AbstractIntegrationTest {
iterateAssertCount(5, indexCounter.get(), 10); iterateAssertCount(5, indexCounter.get(), 10);
} }
@Test @Test @TestLogging("action.search.type:TRACE,action.admin.indices.refresh:TRACE")
@Slow @Slow
public void recoverWhileUnderLoadAllocateBackupsRelocatePrimariesTest() throws Exception { public void recoverWhileUnderLoadAllocateBackupsRelocatePrimariesTest() throws Exception {
logger.info("--> creating test index ..."); logger.info("--> creating test index ...");
@ -205,7 +205,7 @@ public class RecoveryWhileUnderLoadTests extends AbstractIntegrationTest {
iterateAssertCount(5, indexCounter.get(), 10); iterateAssertCount(5, indexCounter.get(), 10);
} }
@Test @Test @TestLogging("action.search.type:TRACE,action.admin.indices.refresh:TRACE")
@Slow @Slow
public void recoverWhileUnderLoadWithNodeShutdown() throws Exception { public void recoverWhileUnderLoadWithNodeShutdown() throws Exception {
logger.info("--> creating test index ..."); logger.info("--> creating test index ...");
@ -297,7 +297,7 @@ public class RecoveryWhileUnderLoadTests extends AbstractIntegrationTest {
} }
private void iterateAssertCount(final int numberOfShards, final long numberOfDocs, int iterations) throws Exception { private void iterateAssertCount(final int numberOfShards, final long numberOfDocs, final int iterations) throws Exception {
SearchResponse[] iterationResults = new SearchResponse[iterations]; SearchResponse[] iterationResults = new SearchResponse[iterations];
boolean error = false; boolean error = false;
for (int i = 0; i < iterations; i++) { for (int i = 0; i < iterations; i++) {
@ -314,19 +314,24 @@ public class RecoveryWhileUnderLoadTests extends AbstractIntegrationTest {
IndicesStatsResponse indicesStatsResponse = client().admin().indices().prepareStats().get(); IndicesStatsResponse indicesStatsResponse = client().admin().indices().prepareStats().get();
for (ShardStats shardStats : indicesStatsResponse.getShards()) { for (ShardStats shardStats : indicesStatsResponse.getShards()) {
DocsStats docsStats = shardStats.getStats().docs; DocsStats docsStats = shardStats.getStats().docs;
logger.info("Shard [{}] - count {}, primary {}", shardStats.getShardId(), docsStats.getCount(), shardStats.getShardRouting().primary()); logger.info("shard [{}] - count {}, primary {}", shardStats.getShardId(), docsStats.getCount(), shardStats.getShardRouting().primary());
} }
//if there was an error we try to wait and see if at some point it'll get fixed //if there was an error we try to wait and see if at some point it'll get fixed
//otherwise it means we are losing documents
logger.info("--> trying to wait"); logger.info("--> trying to wait");
assertThat(awaitBusy(new Predicate<Object>() { assertThat(awaitBusy(new Predicate<Object>() {
@Override @Override
public boolean apply(Object o) { public boolean apply(Object o) {
boolean error = false;
for (int i = 0; i < iterations; i++) {
SearchResponse searchResponse = client().prepareSearch().setSearchType(SearchType.COUNT).setQuery(matchAllQuery()).get(); SearchResponse searchResponse = client().prepareSearch().setSearchType(SearchType.COUNT).setQuery(matchAllQuery()).get();
return searchResponse.getHits().totalHits() == numberOfDocs; if (searchResponse.getHits().totalHits() != numberOfDocs) {
error = true;
} }
}, 30, TimeUnit.SECONDS), equalTo(true)); }
return !error;
}
}, 5, TimeUnit.MINUTES), equalTo(true));
} }
//lets now make the test fail if it was supposed to fail //lets now make the test fail if it was supposed to fail