From 6d2077b0a30a33f402ff645cd53899e24c02bc9f Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Thu, 3 Jul 2014 13:56:10 +0200 Subject: [PATCH] [TEST] Split up random bulks more often and also if the document set is smallish --- .../elasticsearch/test/ElasticsearchIntegrationTest.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java b/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java index 9b101322493..942c3f7bfd7 100644 --- a/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java +++ b/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java @@ -202,6 +202,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase * Maximum number of async operations that indexRandom will kick off at one time. */ private static final int MAX_IN_FLIGHT_ASYNC_INDEXES = 150; + /** * Maximum number of documents in a single bulk index request. */ @@ -1219,8 +1220,10 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase } } } else { - logger.info("Index [{}] docs async: [{}] bulk: [{}]", builders.size(), false, true); - for (List segmented : Lists.partition(builders, between(MAX_BULK_INDEX_REQUEST_SIZE / 2, MAX_BULK_INDEX_REQUEST_SIZE))) { + List> partition = Lists.partition(builders, Math.min(MAX_BULK_INDEX_REQUEST_SIZE, + Math.max(1, (int) (builders.size() * randomDouble())))); + logger.info("Index [{}] docs async: [{}] bulk: [{}] partitions [{}]", builders.size(), false, true, partition.size()); + for (List segmented : partition) { BulkRequestBuilder bulkBuilder = client().prepareBulk(); for (IndexRequestBuilder indexRequestBuilder : segmented) { bulkBuilder.add(indexRequestBuilder);