Test: force merge index in the end of IndexStatsTests.throttleStats

This works around slow IO (fsync) causing the test-framework cleanup
to timeout at 30 seconds when trying to delete the index.

Closes #8528
This commit is contained in:
Michael McCandless 2014-11-18 07:25:16 -05:00 committed by mikemccand
parent fd8a56dc0b
commit 2f40b464ad
1 changed files with 41 additions and 51 deletions

View File

@ -36,7 +36,6 @@ import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.io.stream.BytesStreamInput; import org.elasticsearch.common.io.stream.BytesStreamInput;
import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.io.stream.BytesStreamOutput;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.merge.policy.TieredMergePolicyProvider; import org.elasticsearch.index.merge.policy.TieredMergePolicyProvider;
@ -331,16 +330,6 @@ public class IndexStatsTests extends ElasticsearchIntegrationTest {
@Test @Test
public void throttleStats() throws Exception { public void throttleStats() throws Exception {
String luceneIWLevel = Loggers.getLogger("lucene.iw").getLevel();
Loggers.getLogger("lucene.iw").setLevel("TRACE");
String msLevel = Loggers.getLogger("index.merge.scheduler").getLevel();
Loggers.getLogger("index.merge.scheduler").setLevel("TRACE");
String indexShardLevel = Loggers.getLogger("index.shard.service").getLevel();
Loggers.getLogger("index.shard.service").setLevel("TRACE");
String engineLevel = Loggers.getLogger("test.engine").getLevel();
Loggers.getLogger("test.engine").setLevel("TRACE");
try {
assertAcked(prepareCreate("test") assertAcked(prepareCreate("test")
.setSettings(ImmutableSettings.builder() .setSettings(ImmutableSettings.builder()
.put(AbstractIndexStore.INDEX_STORE_THROTTLE_TYPE, "merge") .put(AbstractIndexStore.INDEX_STORE_THROTTLE_TYPE, "merge")
@ -380,12 +369,13 @@ public class IndexStatsTests extends ElasticsearchIntegrationTest {
fail("index throttling didn't kick in after 5 minutes of intense merging"); fail("index throttling didn't kick in after 5 minutes of intense merging");
} }
} }
} finally {
Loggers.getLogger("lucene.iw").setLevel(luceneIWLevel); // Optimize & flush and wait; else we sometimes get a "Delete Index failed - not acked"
Loggers.getLogger("index.merge.scheduler").setLevel(msLevel); // when ElasticsearchIntegrationTest.after tries to remove indices created by the test:
Loggers.getLogger("index.shard.service").setLevel(indexShardLevel); logger.info("test: now optimize");
Loggers.getLogger("test.engine").setLevel(engineLevel); client().admin().indices().prepareOptimize("test").setWaitForMerge(true).get();
} flush();
logger.info("test: test done");
} }
@Test @Test