Skip to content

Commit d9947c6

Browse files
authored
[CCR] Rename idle_shard_retry_delay to poll_timout in auto follow patterns (#33821)
1 parent 68c0a29 commit d9947c6

File tree

6 files changed

+34
-34
lines changed

6 files changed

+34
-34
lines changed

x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/AutoFollowCoordinator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ private void followLeaderIndex(String clusterAlias, Index indexToFollow,
306306
request.setMaxConcurrentWriteBatches(pattern.getMaxConcurrentWriteBatches());
307307
request.setMaxWriteBufferSize(pattern.getMaxWriteBufferSize());
308308
request.setMaxRetryDelay(pattern.getMaxRetryDelay());
309-
request.setPollTimeout(pattern.getIdleShardRetryDelay());
309+
request.setPollTimeout(pattern.getPollTimeout());
310310

311311
// Execute if the create and follow api call succeeds:
312312
Runnable successHandler = () -> {

x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/TransportPutAutoFollowPatternAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ static ClusterState innerPut(PutAutoFollowPatternAction.Request request,
156156
request.getMaxConcurrentWriteBatches(),
157157
request.getMaxWriteBufferSize(),
158158
request.getMaxRetryDelay(),
159-
request.getIdleShardRetryDelay(),
159+
request.getPollTimeout(),
160160
filteredHeaders);
161161
patterns.put(request.getLeaderClusterAlias(), autoFollowPattern);
162162
ClusterState.Builder newState = ClusterState.builder(localState);

x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/AutoFollowTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public void testAutoFollowParameterAreDelegated() throws Exception {
136136
request.setMaxRetryDelay(TimeValue.timeValueMillis(500));
137137
}
138138
if (randomBoolean()) {
139-
request.setIdleShardRetryDelay(TimeValue.timeValueMillis(500));
139+
request.setPollTimeout(TimeValue.timeValueMillis(500));
140140
}
141141
assertTrue(client().execute(PutAutoFollowPatternAction.INSTANCE, request).actionGet().isAcknowledged());
142142

@@ -167,8 +167,8 @@ public void testAutoFollowParameterAreDelegated() throws Exception {
167167
if (request.getMaxRetryDelay() != null) {
168168
assertThat(shardFollowTask.getMaxRetryDelay(), equalTo(request.getMaxRetryDelay()));
169169
}
170-
if (request.getIdleShardRetryDelay() != null) {
171-
assertThat(shardFollowTask.getPollTimeout(), equalTo(request.getIdleShardRetryDelay()));
170+
if (request.getPollTimeout() != null) {
171+
assertThat(shardFollowTask.getPollTimeout(), equalTo(request.getPollTimeout()));
172172
}
173173
});
174174
}

x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/PutAutoFollowPatternRequestTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ protected PutAutoFollowPatternAction.Request createTestInstance() {
4545
request.setFollowIndexNamePattern(randomAlphaOfLength(4));
4646
}
4747
if (randomBoolean()) {
48-
request.setIdleShardRetryDelay(TimeValue.timeValueMillis(500));
48+
request.setPollTimeout(TimeValue.timeValueMillis(500));
4949
}
5050
if (randomBoolean()) {
5151
request.setMaxRetryDelay(TimeValue.timeValueMillis(500));

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/AutoFollowMetadata.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public static class AutoFollowPattern implements Writeable, ToXContentObject {
171171
public static final ParseField MAX_CONCURRENT_WRITE_BATCHES = new ParseField("max_concurrent_write_batches");
172172
public static final ParseField MAX_WRITE_BUFFER_SIZE = new ParseField("max_write_buffer_size");
173173
public static final ParseField MAX_RETRY_DELAY = new ParseField("max_retry_delay");
174-
public static final ParseField IDLE_SHARD_RETRY_DELAY = new ParseField("idle_shard_retry_delay");
174+
public static final ParseField POLL_TIMEOUT = new ParseField("poll_timeout");
175175
private static final ParseField HEADERS = new ParseField("headers");
176176

177177
@SuppressWarnings("unchecked")
@@ -193,8 +193,8 @@ public static class AutoFollowPattern implements Writeable, ToXContentObject {
193193
(p, c) -> TimeValue.parseTimeValue(p.text(), MAX_RETRY_DELAY.getPreferredName()),
194194
MAX_RETRY_DELAY, ObjectParser.ValueType.STRING);
195195
PARSER.declareField(ConstructingObjectParser.optionalConstructorArg(),
196-
(p, c) -> TimeValue.parseTimeValue(p.text(), IDLE_SHARD_RETRY_DELAY.getPreferredName()),
197-
IDLE_SHARD_RETRY_DELAY, ObjectParser.ValueType.STRING);
196+
(p, c) -> TimeValue.parseTimeValue(p.text(), POLL_TIMEOUT.getPreferredName()),
197+
POLL_TIMEOUT, ObjectParser.ValueType.STRING);
198198
PARSER.declareObject(ConstructingObjectParser.constructorArg(), (p, c) -> p.mapStrings(), HEADERS);
199199
}
200200

@@ -206,7 +206,7 @@ public static class AutoFollowPattern implements Writeable, ToXContentObject {
206206
private final Integer maxConcurrentWriteBatches;
207207
private final Integer maxWriteBufferSize;
208208
private final TimeValue maxRetryDelay;
209-
private final TimeValue idleShardRetryDelay;
209+
private final TimeValue pollTimeout;
210210
private final Map<String, String> headers;
211211

212212
public AutoFollowPattern(List<String> leaderIndexPatterns,
@@ -217,7 +217,7 @@ public AutoFollowPattern(List<String> leaderIndexPatterns,
217217
Integer maxConcurrentWriteBatches,
218218
Integer maxWriteBufferSize,
219219
TimeValue maxRetryDelay,
220-
TimeValue idleShardRetryDelay,
220+
TimeValue pollTimeout,
221221
Map<String, String> headers) {
222222
this.leaderIndexPatterns = leaderIndexPatterns;
223223
this.followIndexPattern = followIndexPattern;
@@ -227,7 +227,7 @@ public AutoFollowPattern(List<String> leaderIndexPatterns,
227227
this.maxConcurrentWriteBatches = maxConcurrentWriteBatches;
228228
this.maxWriteBufferSize = maxWriteBufferSize;
229229
this.maxRetryDelay = maxRetryDelay;
230-
this.idleShardRetryDelay = idleShardRetryDelay;
230+
this.pollTimeout = pollTimeout;
231231
this.headers = headers != null ? Collections.unmodifiableMap(headers) : Collections.emptyMap();
232232
}
233233

@@ -240,7 +240,7 @@ public AutoFollowPattern(List<String> leaderIndexPatterns,
240240
maxConcurrentWriteBatches = in.readOptionalVInt();
241241
maxWriteBufferSize = in.readOptionalVInt();
242242
maxRetryDelay = in.readOptionalTimeValue();
243-
idleShardRetryDelay = in.readOptionalTimeValue();
243+
pollTimeout = in.readOptionalTimeValue();
244244
this.headers = Collections.unmodifiableMap(in.readMap(StreamInput::readString, StreamInput::readString));
245245
}
246246

@@ -284,8 +284,8 @@ public TimeValue getMaxRetryDelay() {
284284
return maxRetryDelay;
285285
}
286286

287-
public TimeValue getIdleShardRetryDelay() {
288-
return idleShardRetryDelay;
287+
public TimeValue getPollTimeout() {
288+
return pollTimeout;
289289
}
290290

291291
public Map<String, String> getHeaders() {
@@ -302,7 +302,7 @@ public void writeTo(StreamOutput out) throws IOException {
302302
out.writeOptionalVInt(maxConcurrentWriteBatches);
303303
out.writeOptionalVInt(maxWriteBufferSize);
304304
out.writeOptionalTimeValue(maxRetryDelay);
305-
out.writeOptionalTimeValue(idleShardRetryDelay);
305+
out.writeOptionalTimeValue(pollTimeout);
306306
out.writeMap(headers, StreamOutput::writeString, StreamOutput::writeString);
307307
}
308308

@@ -330,8 +330,8 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
330330
if (maxRetryDelay != null) {
331331
builder.field(MAX_RETRY_DELAY.getPreferredName(), maxRetryDelay);
332332
}
333-
if (idleShardRetryDelay != null) {
334-
builder.field(IDLE_SHARD_RETRY_DELAY.getPreferredName(), idleShardRetryDelay);
333+
if (pollTimeout != null) {
334+
builder.field(POLL_TIMEOUT.getPreferredName(), pollTimeout);
335335
}
336336
builder.field(HEADERS.getPreferredName(), headers);
337337
return builder;
@@ -355,7 +355,7 @@ public boolean equals(Object o) {
355355
Objects.equals(maxConcurrentWriteBatches, that.maxConcurrentWriteBatches) &&
356356
Objects.equals(maxWriteBufferSize, that.maxWriteBufferSize) &&
357357
Objects.equals(maxRetryDelay, that.maxRetryDelay) &&
358-
Objects.equals(idleShardRetryDelay, that.idleShardRetryDelay) &&
358+
Objects.equals(pollTimeout, that.pollTimeout) &&
359359
Objects.equals(headers, that.headers);
360360
}
361361

@@ -370,7 +370,7 @@ public int hashCode() {
370370
maxConcurrentWriteBatches,
371371
maxWriteBufferSize,
372372
maxRetryDelay,
373-
idleShardRetryDelay,
373+
pollTimeout,
374374
headers
375375
);
376376
}

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/action/PutAutoFollowPatternAction.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ public static class Request extends AcknowledgedRequest<Request> implements ToXC
5959
PARSER.declareField(Request::setMaxRetryDelay,
6060
(p, c) -> TimeValue.parseTimeValue(p.text(), AutoFollowPattern.MAX_RETRY_DELAY.getPreferredName()),
6161
AutoFollowPattern.MAX_RETRY_DELAY, ObjectParser.ValueType.STRING);
62-
PARSER.declareField(Request::setIdleShardRetryDelay,
63-
(p, c) -> TimeValue.parseTimeValue(p.text(), AutoFollowPattern.IDLE_SHARD_RETRY_DELAY.getPreferredName()),
64-
AutoFollowPattern.IDLE_SHARD_RETRY_DELAY, ObjectParser.ValueType.STRING);
62+
PARSER.declareField(Request::setPollTimeout,
63+
(p, c) -> TimeValue.parseTimeValue(p.text(), AutoFollowPattern.POLL_TIMEOUT.getPreferredName()),
64+
AutoFollowPattern.POLL_TIMEOUT, ObjectParser.ValueType.STRING);
6565
}
6666

6767
public static Request fromXContent(XContentParser parser, String remoteClusterAlias) throws IOException {
@@ -88,7 +88,7 @@ public static Request fromXContent(XContentParser parser, String remoteClusterAl
8888
private Integer maxConcurrentWriteBatches;
8989
private Integer maxWriteBufferSize;
9090
private TimeValue maxRetryDelay;
91-
private TimeValue idleShardRetryDelay;
91+
private TimeValue pollTimeout;
9292

9393
@Override
9494
public ActionRequestValidationException validate() {
@@ -189,12 +189,12 @@ public void setMaxRetryDelay(TimeValue maxRetryDelay) {
189189
this.maxRetryDelay = maxRetryDelay;
190190
}
191191

192-
public TimeValue getIdleShardRetryDelay() {
193-
return idleShardRetryDelay;
192+
public TimeValue getPollTimeout() {
193+
return pollTimeout;
194194
}
195195

196-
public void setIdleShardRetryDelay(TimeValue idleShardRetryDelay) {
197-
this.idleShardRetryDelay = idleShardRetryDelay;
196+
public void setPollTimeout(TimeValue pollTimeout) {
197+
this.pollTimeout = pollTimeout;
198198
}
199199

200200
@Override
@@ -209,7 +209,7 @@ public void readFrom(StreamInput in) throws IOException {
209209
maxConcurrentWriteBatches = in.readOptionalVInt();
210210
maxWriteBufferSize = in.readOptionalVInt();
211211
maxRetryDelay = in.readOptionalTimeValue();
212-
idleShardRetryDelay = in.readOptionalTimeValue();
212+
pollTimeout = in.readOptionalTimeValue();
213213
}
214214

215215
@Override
@@ -224,7 +224,7 @@ public void writeTo(StreamOutput out) throws IOException {
224224
out.writeOptionalVInt(maxConcurrentWriteBatches);
225225
out.writeOptionalVInt(maxWriteBufferSize);
226226
out.writeOptionalTimeValue(maxRetryDelay);
227-
out.writeOptionalTimeValue(idleShardRetryDelay);
227+
out.writeOptionalTimeValue(pollTimeout);
228228
}
229229

230230
@Override
@@ -254,8 +254,8 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
254254
if (maxRetryDelay != null) {
255255
builder.field(AutoFollowPattern.MAX_RETRY_DELAY.getPreferredName(), maxRetryDelay.getStringRep());
256256
}
257-
if (idleShardRetryDelay != null) {
258-
builder.field(AutoFollowPattern.IDLE_SHARD_RETRY_DELAY.getPreferredName(), idleShardRetryDelay.getStringRep());
257+
if (pollTimeout != null) {
258+
builder.field(AutoFollowPattern.POLL_TIMEOUT.getPreferredName(), pollTimeout.getStringRep());
259259
}
260260
}
261261
builder.endObject();
@@ -276,7 +276,7 @@ public boolean equals(Object o) {
276276
Objects.equals(maxConcurrentWriteBatches, request.maxConcurrentWriteBatches) &&
277277
Objects.equals(maxWriteBufferSize, request.maxWriteBufferSize) &&
278278
Objects.equals(maxRetryDelay, request.maxRetryDelay) &&
279-
Objects.equals(idleShardRetryDelay, request.idleShardRetryDelay);
279+
Objects.equals(pollTimeout, request.pollTimeout);
280280
}
281281

282282
@Override
@@ -291,7 +291,7 @@ public int hashCode() {
291291
maxConcurrentWriteBatches,
292292
maxWriteBufferSize,
293293
maxRetryDelay,
294-
idleShardRetryDelay
294+
pollTimeout
295295
);
296296
}
297297
}

0 commit comments

Comments
 (0)