[TEST] use CFS consistently to not trigger single segment merge without force flag
This commit is contained in:
parent
06fb9ff761
commit
5f188d29fa
|
@ -31,6 +31,7 @@ import org.elasticsearch.common.settings.ImmutableSettings;
|
|||
import org.elasticsearch.common.util.BloomFilter;
|
||||
import org.elasticsearch.index.codec.CodecService;
|
||||
import org.elasticsearch.index.engine.Segment;
|
||||
import org.elasticsearch.index.merge.policy.AbstractMergePolicyProvider;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Test;
|
||||
|
@ -40,6 +41,8 @@ import java.util.HashSet;
|
|||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
|
||||
public class InternalEngineIntegrationTest extends ElasticsearchIntegrationTest {
|
||||
|
||||
@Test
|
||||
|
@ -135,7 +138,14 @@ public class InternalEngineIntegrationTest extends ElasticsearchIntegrationTest
|
|||
}
|
||||
|
||||
public void testForceOptimize() throws ExecutionException, InterruptedException {
|
||||
client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.builder().put("number_of_replicas", 0).put("number_of_shards", 1)).get();
|
||||
boolean compound = randomBoolean();
|
||||
assertAcked(client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.builder()
|
||||
.put("number_of_replicas", 0)
|
||||
.put("number_of_shards", 1)
|
||||
// this is important otherwise the MP will still trigger a merge even if there is only one segment
|
||||
.put(InternalEngine.INDEX_COMPOUND_ON_FLUSH, compound)
|
||||
.put(AbstractMergePolicyProvider.INDEX_COMPOUND_FORMAT, compound)
|
||||
));
|
||||
final int numDocs = randomIntBetween(10, 100);
|
||||
IndexRequestBuilder[] builders = new IndexRequestBuilder[numDocs];
|
||||
for (int i = 0; i < builders.length; i++) {
|
||||
|
|
Loading…
Reference in New Issue