Skip to content

Commit cc7f0b4

Browse files
author
Hendrik Muhs
committed
[Transform] Further increase the timeout and improve message for testStopWaitForCheckpoint (#64865)
improve timeout when starting a transform with retry, improve transform ids in tests to avoid clashes in logs fixes #63365
1 parent b30ef54 commit cc7f0b4

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

x-pack/plugin/transform/qa/multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/transform/integration/TransformIT.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public void cleanTransforms() throws IOException {
5656

5757
public void testTransformCrud() throws Exception {
5858
String indexName = "basic-crud-reviews";
59+
String transformId = "transform-crud";
5960
createReviewsIndex(indexName, 100);
6061

6162
Map<String, SingleGroupSource> groups = new HashMap<>();
@@ -67,7 +68,7 @@ public void testTransformCrud() throws Exception {
6768
.addAggregator(AggregationBuilders.avg("review_score").field("stars"))
6869
.addAggregator(AggregationBuilders.max("timestamp").field("timestamp"));
6970

70-
TransformConfig config = createTransformConfig("transform-crud", groups, aggs, "reviews-by-user-business-day", indexName);
71+
TransformConfig config = createTransformConfig(transformId, groups, aggs, "reviews-by-user-business-day", indexName);
7172

7273
assertTrue(putTransform(config, RequestOptions.DEFAULT).isAcknowledged());
7374
assertTrue(startTransform(config.getId(), RequestOptions.DEFAULT).isAcknowledged());
@@ -85,6 +86,7 @@ public void testTransformCrud() throws Exception {
8586

8687
public void testContinuousTransformCrud() throws Exception {
8788
String indexName = "continuous-crud-reviews";
89+
String transformId = "transform-continuous-crud";
8890
createReviewsIndex(indexName, 100);
8991

9092
Map<String, SingleGroupSource> groups = new HashMap<>();
@@ -97,7 +99,7 @@ public void testContinuousTransformCrud() throws Exception {
9799
.addAggregator(AggregationBuilders.max("timestamp").field("timestamp"));
98100

99101
TransformConfig config = createTransformConfigBuilder(
100-
"transform-crud",
102+
transformId,
101103
groups,
102104
aggs,
103105
"reviews-by-user-business-day",
@@ -289,6 +291,8 @@ public void testStopWaitForCheckpoint() throws Exception {
289291

290292
public void testContinuousTransformRethrottle() throws Exception {
291293
String indexName = "continuous-crud-reviews-throttled";
294+
String transformId = "transform-continuous-crud-throttled";
295+
292296
createReviewsIndex(indexName, 1000);
293297

294298
Map<String, SingleGroupSource> groups = new HashMap<>();
@@ -301,7 +305,7 @@ public void testContinuousTransformRethrottle() throws Exception {
301305
.addAggregator(AggregationBuilders.max("timestamp").field("timestamp"));
302306

303307
TransformConfig config = createTransformConfigBuilder(
304-
"transform-crud",
308+
transformId,
305309
groups,
306310
aggs,
307311
"reviews-by-user-business-day",

x-pack/plugin/transform/qa/multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/transform/integration/TransformIntegTestCase.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ protected StartTransformResponse startTransform(String id, RequestOptions option
145145
// workaround for https://github.com/elastic/elasticsearch/issues/62204
146146
protected StartTransformResponse startTransformWithRetryOnConflict(String id, RequestOptions options) throws Exception {
147147
final int totalRetries = 10;
148+
long totalSleepTime = 0;
148149
ElasticsearchStatusException lastConflict = null;
149150
for (int retries = totalRetries; retries > 0; --retries) {
150151
try (RestHighLevelClient restClient = new TestRestHighLevelClient()) {
@@ -163,10 +164,15 @@ protected StartTransformResponse startTransformWithRetryOnConflict(String id, Re
163164
}
164165

165166
lastConflict = e;
166-
Thread.sleep(5 * (1 + totalRetries - retries));
167+
168+
// wait between some ms max 5s, between a check,
169+
// with 10 retries the total retry should not be longer than 10s
170+
final long sleepTime = 5 * Math.round((Math.min(Math.pow(2, 1 + totalRetries - retries), 1000)));
171+
totalSleepTime += sleepTime;
172+
Thread.sleep(sleepTime);
167173
}
168174
}
169-
throw lastConflict;
175+
throw new AssertionError("startTransformWithRetryOnConflict timed out after " + totalSleepTime + "ms", lastConflict);
170176
}
171177

172178
protected AcknowledgedResponse deleteTransform(String id) throws IOException {

0 commit comments

Comments
 (0)