Skip to content

Commit e351b45

Browse files
committed
[CCR] Rename idle_shard_retry_delay to poll_timout in auto follow patterns (#33821)
1 parent 3f47e6c commit e351b45

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
@@ -67,9 +67,9 @@ public static class Request extends AcknowledgedRequest<Request> implements ToXC
6767
PARSER.declareField(Request::setMaxRetryDelay,
6868
(p, c) -> TimeValue.parseTimeValue(p.text(), AutoFollowPattern.MAX_RETRY_DELAY.getPreferredName()),
6969
AutoFollowPattern.MAX_RETRY_DELAY, ObjectParser.ValueType.STRING);
70-
PARSER.declareField(Request::setIdleShardRetryDelay,
71-
(p, c) -> TimeValue.parseTimeValue(p.text(), AutoFollowPattern.IDLE_SHARD_RETRY_DELAY.getPreferredName()),
72-
AutoFollowPattern.IDLE_SHARD_RETRY_DELAY, ObjectParser.ValueType.STRING);
70+
PARSER.declareField(Request::setPollTimeout,
71+
(p, c) -> TimeValue.parseTimeValue(p.text(), AutoFollowPattern.POLL_TIMEOUT.getPreferredName()),
72+
AutoFollowPattern.POLL_TIMEOUT, ObjectParser.ValueType.STRING);
7373
}
7474

7575
public static Request fromXContent(XContentParser parser, String remoteClusterAlias) throws IOException {
@@ -96,7 +96,7 @@ public static Request fromXContent(XContentParser parser, String remoteClusterAl
9696
private Integer maxConcurrentWriteBatches;
9797
private Integer maxWriteBufferSize;
9898
private TimeValue maxRetryDelay;
99-
private TimeValue idleShardRetryDelay;
99+
private TimeValue pollTimeout;
100100

101101
@Override
102102
public ActionRequestValidationException validate() {
@@ -197,12 +197,12 @@ public void setMaxRetryDelay(TimeValue maxRetryDelay) {
197197
this.maxRetryDelay = maxRetryDelay;
198198
}
199199

200-
public TimeValue getIdleShardRetryDelay() {
201-
return idleShardRetryDelay;
200+
public TimeValue getPollTimeout() {
201+
return pollTimeout;
202202
}
203203

204-
public void setIdleShardRetryDelay(TimeValue idleShardRetryDelay) {
205-
this.idleShardRetryDelay = idleShardRetryDelay;
204+
public void setPollTimeout(TimeValue pollTimeout) {
205+
this.pollTimeout = pollTimeout;
206206
}
207207

208208
@Override
@@ -217,7 +217,7 @@ public void readFrom(StreamInput in) throws IOException {
217217
maxConcurrentWriteBatches = in.readOptionalVInt();
218218
maxWriteBufferSize = in.readOptionalVInt();
219219
maxRetryDelay = in.readOptionalTimeValue();
220-
idleShardRetryDelay = in.readOptionalTimeValue();
220+
pollTimeout = in.readOptionalTimeValue();
221221
}
222222

223223
@Override
@@ -232,7 +232,7 @@ public void writeTo(StreamOutput out) throws IOException {
232232
out.writeOptionalVInt(maxConcurrentWriteBatches);
233233
out.writeOptionalVInt(maxWriteBufferSize);
234234
out.writeOptionalTimeValue(maxRetryDelay);
235-
out.writeOptionalTimeValue(idleShardRetryDelay);
235+
out.writeOptionalTimeValue(pollTimeout);
236236
}
237237

238238
@Override
@@ -262,8 +262,8 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
262262
if (maxRetryDelay != null) {
263263
builder.field(AutoFollowPattern.MAX_RETRY_DELAY.getPreferredName(), maxRetryDelay.getStringRep());
264264
}
265-
if (idleShardRetryDelay != null) {
266-
builder.field(AutoFollowPattern.IDLE_SHARD_RETRY_DELAY.getPreferredName(), idleShardRetryDelay.getStringRep());
265+
if (pollTimeout != null) {
266+
builder.field(AutoFollowPattern.POLL_TIMEOUT.getPreferredName(), pollTimeout.getStringRep());
267267
}
268268
}
269269
builder.endObject();
@@ -284,7 +284,7 @@ public boolean equals(Object o) {
284284
Objects.equals(maxConcurrentWriteBatches, request.maxConcurrentWriteBatches) &&
285285
Objects.equals(maxWriteBufferSize, request.maxWriteBufferSize) &&
286286
Objects.equals(maxRetryDelay, request.maxRetryDelay) &&
287-
Objects.equals(idleShardRetryDelay, request.idleShardRetryDelay);
287+
Objects.equals(pollTimeout, request.pollTimeout);
288288
}
289289

290290
@Override
@@ -299,7 +299,7 @@ public int hashCode() {
299299
maxConcurrentWriteBatches,
300300
maxWriteBufferSize,
301301
maxRetryDelay,
302-
idleShardRetryDelay
302+
pollTimeout
303303
);
304304
}
305305
}

0 commit comments

Comments
 (0)