From d9947c631a9d398172b717b7864e8ffbcebcdb3c Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Wed, 19 Sep 2018 13:13:20 +0200 Subject: [PATCH] [CCR] Rename idle_shard_retry_delay to poll_timout in auto follow patterns (#33821) --- .../ccr/action/AutoFollowCoordinator.java | 2 +- .../TransportPutAutoFollowPatternAction.java | 2 +- .../xpack/ccr/action/AutoFollowTests.java | 6 ++-- .../PutAutoFollowPatternRequestTests.java | 2 +- .../xpack/core/ccr/AutoFollowMetadata.java | 28 +++++++++---------- .../action/PutAutoFollowPatternAction.java | 28 +++++++++---------- 6 files changed, 34 insertions(+), 34 deletions(-) diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/AutoFollowCoordinator.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/AutoFollowCoordinator.java index 46679d22520c3..78d21683958de 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/AutoFollowCoordinator.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/AutoFollowCoordinator.java @@ -306,7 +306,7 @@ private void followLeaderIndex(String clusterAlias, Index indexToFollow, request.setMaxConcurrentWriteBatches(pattern.getMaxConcurrentWriteBatches()); request.setMaxWriteBufferSize(pattern.getMaxWriteBufferSize()); request.setMaxRetryDelay(pattern.getMaxRetryDelay()); - request.setPollTimeout(pattern.getIdleShardRetryDelay()); + request.setPollTimeout(pattern.getPollTimeout()); // Execute if the create and follow api call succeeds: Runnable successHandler = () -> { diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/TransportPutAutoFollowPatternAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/TransportPutAutoFollowPatternAction.java index 748ba03f034bc..2f9dd02648dc7 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/TransportPutAutoFollowPatternAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/TransportPutAutoFollowPatternAction.java @@ -156,7 +156,7 @@ static ClusterState innerPut(PutAutoFollowPatternAction.Request request, request.getMaxConcurrentWriteBatches(), request.getMaxWriteBufferSize(), request.getMaxRetryDelay(), - request.getIdleShardRetryDelay(), + request.getPollTimeout(), filteredHeaders); patterns.put(request.getLeaderClusterAlias(), autoFollowPattern); ClusterState.Builder newState = ClusterState.builder(localState); diff --git a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/AutoFollowTests.java b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/AutoFollowTests.java index 6cea48cada8db..1b0f15551916b 100644 --- a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/AutoFollowTests.java +++ b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/AutoFollowTests.java @@ -136,7 +136,7 @@ public void testAutoFollowParameterAreDelegated() throws Exception { request.setMaxRetryDelay(TimeValue.timeValueMillis(500)); } if (randomBoolean()) { - request.setIdleShardRetryDelay(TimeValue.timeValueMillis(500)); + request.setPollTimeout(TimeValue.timeValueMillis(500)); } assertTrue(client().execute(PutAutoFollowPatternAction.INSTANCE, request).actionGet().isAcknowledged()); @@ -167,8 +167,8 @@ public void testAutoFollowParameterAreDelegated() throws Exception { if (request.getMaxRetryDelay() != null) { assertThat(shardFollowTask.getMaxRetryDelay(), equalTo(request.getMaxRetryDelay())); } - if (request.getIdleShardRetryDelay() != null) { - assertThat(shardFollowTask.getPollTimeout(), equalTo(request.getIdleShardRetryDelay())); + if (request.getPollTimeout() != null) { + assertThat(shardFollowTask.getPollTimeout(), equalTo(request.getPollTimeout())); } }); } diff --git a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/PutAutoFollowPatternRequestTests.java b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/PutAutoFollowPatternRequestTests.java index d3688c1136c6f..6fafaab7995ee 100644 --- a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/PutAutoFollowPatternRequestTests.java +++ b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/PutAutoFollowPatternRequestTests.java @@ -45,7 +45,7 @@ protected PutAutoFollowPatternAction.Request createTestInstance() { request.setFollowIndexNamePattern(randomAlphaOfLength(4)); } if (randomBoolean()) { - request.setIdleShardRetryDelay(TimeValue.timeValueMillis(500)); + request.setPollTimeout(TimeValue.timeValueMillis(500)); } if (randomBoolean()) { request.setMaxRetryDelay(TimeValue.timeValueMillis(500)); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/AutoFollowMetadata.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/AutoFollowMetadata.java index cc4ea7b009ec1..75832271bee5a 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/AutoFollowMetadata.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/AutoFollowMetadata.java @@ -171,7 +171,7 @@ public static class AutoFollowPattern implements Writeable, ToXContentObject { public static final ParseField MAX_CONCURRENT_WRITE_BATCHES = new ParseField("max_concurrent_write_batches"); public static final ParseField MAX_WRITE_BUFFER_SIZE = new ParseField("max_write_buffer_size"); public static final ParseField MAX_RETRY_DELAY = new ParseField("max_retry_delay"); - public static final ParseField IDLE_SHARD_RETRY_DELAY = new ParseField("idle_shard_retry_delay"); + public static final ParseField POLL_TIMEOUT = new ParseField("poll_timeout"); private static final ParseField HEADERS = new ParseField("headers"); @SuppressWarnings("unchecked") @@ -193,8 +193,8 @@ public static class AutoFollowPattern implements Writeable, ToXContentObject { (p, c) -> TimeValue.parseTimeValue(p.text(), MAX_RETRY_DELAY.getPreferredName()), MAX_RETRY_DELAY, ObjectParser.ValueType.STRING); PARSER.declareField(ConstructingObjectParser.optionalConstructorArg(), - (p, c) -> TimeValue.parseTimeValue(p.text(), IDLE_SHARD_RETRY_DELAY.getPreferredName()), - IDLE_SHARD_RETRY_DELAY, ObjectParser.ValueType.STRING); + (p, c) -> TimeValue.parseTimeValue(p.text(), POLL_TIMEOUT.getPreferredName()), + POLL_TIMEOUT, ObjectParser.ValueType.STRING); PARSER.declareObject(ConstructingObjectParser.constructorArg(), (p, c) -> p.mapStrings(), HEADERS); } @@ -206,7 +206,7 @@ public static class AutoFollowPattern implements Writeable, ToXContentObject { private final Integer maxConcurrentWriteBatches; private final Integer maxWriteBufferSize; private final TimeValue maxRetryDelay; - private final TimeValue idleShardRetryDelay; + private final TimeValue pollTimeout; private final Map headers; public AutoFollowPattern(List leaderIndexPatterns, @@ -217,7 +217,7 @@ public AutoFollowPattern(List leaderIndexPatterns, Integer maxConcurrentWriteBatches, Integer maxWriteBufferSize, TimeValue maxRetryDelay, - TimeValue idleShardRetryDelay, + TimeValue pollTimeout, Map headers) { this.leaderIndexPatterns = leaderIndexPatterns; this.followIndexPattern = followIndexPattern; @@ -227,7 +227,7 @@ public AutoFollowPattern(List leaderIndexPatterns, this.maxConcurrentWriteBatches = maxConcurrentWriteBatches; this.maxWriteBufferSize = maxWriteBufferSize; this.maxRetryDelay = maxRetryDelay; - this.idleShardRetryDelay = idleShardRetryDelay; + this.pollTimeout = pollTimeout; this.headers = headers != null ? Collections.unmodifiableMap(headers) : Collections.emptyMap(); } @@ -240,7 +240,7 @@ public AutoFollowPattern(List leaderIndexPatterns, maxConcurrentWriteBatches = in.readOptionalVInt(); maxWriteBufferSize = in.readOptionalVInt(); maxRetryDelay = in.readOptionalTimeValue(); - idleShardRetryDelay = in.readOptionalTimeValue(); + pollTimeout = in.readOptionalTimeValue(); this.headers = Collections.unmodifiableMap(in.readMap(StreamInput::readString, StreamInput::readString)); } @@ -284,8 +284,8 @@ public TimeValue getMaxRetryDelay() { return maxRetryDelay; } - public TimeValue getIdleShardRetryDelay() { - return idleShardRetryDelay; + public TimeValue getPollTimeout() { + return pollTimeout; } public Map getHeaders() { @@ -302,7 +302,7 @@ public void writeTo(StreamOutput out) throws IOException { out.writeOptionalVInt(maxConcurrentWriteBatches); out.writeOptionalVInt(maxWriteBufferSize); out.writeOptionalTimeValue(maxRetryDelay); - out.writeOptionalTimeValue(idleShardRetryDelay); + out.writeOptionalTimeValue(pollTimeout); out.writeMap(headers, StreamOutput::writeString, StreamOutput::writeString); } @@ -330,8 +330,8 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws if (maxRetryDelay != null) { builder.field(MAX_RETRY_DELAY.getPreferredName(), maxRetryDelay); } - if (idleShardRetryDelay != null) { - builder.field(IDLE_SHARD_RETRY_DELAY.getPreferredName(), idleShardRetryDelay); + if (pollTimeout != null) { + builder.field(POLL_TIMEOUT.getPreferredName(), pollTimeout); } builder.field(HEADERS.getPreferredName(), headers); return builder; @@ -355,7 +355,7 @@ public boolean equals(Object o) { Objects.equals(maxConcurrentWriteBatches, that.maxConcurrentWriteBatches) && Objects.equals(maxWriteBufferSize, that.maxWriteBufferSize) && Objects.equals(maxRetryDelay, that.maxRetryDelay) && - Objects.equals(idleShardRetryDelay, that.idleShardRetryDelay) && + Objects.equals(pollTimeout, that.pollTimeout) && Objects.equals(headers, that.headers); } @@ -370,7 +370,7 @@ public int hashCode() { maxConcurrentWriteBatches, maxWriteBufferSize, maxRetryDelay, - idleShardRetryDelay, + pollTimeout, headers ); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/action/PutAutoFollowPatternAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/action/PutAutoFollowPatternAction.java index 01ebd3f1d81f1..93d8d1fb7d1a2 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/action/PutAutoFollowPatternAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/action/PutAutoFollowPatternAction.java @@ -59,9 +59,9 @@ public static class Request extends AcknowledgedRequest implements ToXC PARSER.declareField(Request::setMaxRetryDelay, (p, c) -> TimeValue.parseTimeValue(p.text(), AutoFollowPattern.MAX_RETRY_DELAY.getPreferredName()), AutoFollowPattern.MAX_RETRY_DELAY, ObjectParser.ValueType.STRING); - PARSER.declareField(Request::setIdleShardRetryDelay, - (p, c) -> TimeValue.parseTimeValue(p.text(), AutoFollowPattern.IDLE_SHARD_RETRY_DELAY.getPreferredName()), - AutoFollowPattern.IDLE_SHARD_RETRY_DELAY, ObjectParser.ValueType.STRING); + PARSER.declareField(Request::setPollTimeout, + (p, c) -> TimeValue.parseTimeValue(p.text(), AutoFollowPattern.POLL_TIMEOUT.getPreferredName()), + AutoFollowPattern.POLL_TIMEOUT, ObjectParser.ValueType.STRING); } public static Request fromXContent(XContentParser parser, String remoteClusterAlias) throws IOException { @@ -88,7 +88,7 @@ public static Request fromXContent(XContentParser parser, String remoteClusterAl private Integer maxConcurrentWriteBatches; private Integer maxWriteBufferSize; private TimeValue maxRetryDelay; - private TimeValue idleShardRetryDelay; + private TimeValue pollTimeout; @Override public ActionRequestValidationException validate() { @@ -189,12 +189,12 @@ public void setMaxRetryDelay(TimeValue maxRetryDelay) { this.maxRetryDelay = maxRetryDelay; } - public TimeValue getIdleShardRetryDelay() { - return idleShardRetryDelay; + public TimeValue getPollTimeout() { + return pollTimeout; } - public void setIdleShardRetryDelay(TimeValue idleShardRetryDelay) { - this.idleShardRetryDelay = idleShardRetryDelay; + public void setPollTimeout(TimeValue pollTimeout) { + this.pollTimeout = pollTimeout; } @Override @@ -209,7 +209,7 @@ public void readFrom(StreamInput in) throws IOException { maxConcurrentWriteBatches = in.readOptionalVInt(); maxWriteBufferSize = in.readOptionalVInt(); maxRetryDelay = in.readOptionalTimeValue(); - idleShardRetryDelay = in.readOptionalTimeValue(); + pollTimeout = in.readOptionalTimeValue(); } @Override @@ -224,7 +224,7 @@ public void writeTo(StreamOutput out) throws IOException { out.writeOptionalVInt(maxConcurrentWriteBatches); out.writeOptionalVInt(maxWriteBufferSize); out.writeOptionalTimeValue(maxRetryDelay); - out.writeOptionalTimeValue(idleShardRetryDelay); + out.writeOptionalTimeValue(pollTimeout); } @Override @@ -254,8 +254,8 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws if (maxRetryDelay != null) { builder.field(AutoFollowPattern.MAX_RETRY_DELAY.getPreferredName(), maxRetryDelay.getStringRep()); } - if (idleShardRetryDelay != null) { - builder.field(AutoFollowPattern.IDLE_SHARD_RETRY_DELAY.getPreferredName(), idleShardRetryDelay.getStringRep()); + if (pollTimeout != null) { + builder.field(AutoFollowPattern.POLL_TIMEOUT.getPreferredName(), pollTimeout.getStringRep()); } } builder.endObject(); @@ -276,7 +276,7 @@ public boolean equals(Object o) { Objects.equals(maxConcurrentWriteBatches, request.maxConcurrentWriteBatches) && Objects.equals(maxWriteBufferSize, request.maxWriteBufferSize) && Objects.equals(maxRetryDelay, request.maxRetryDelay) && - Objects.equals(idleShardRetryDelay, request.idleShardRetryDelay); + Objects.equals(pollTimeout, request.pollTimeout); } @Override @@ -291,7 +291,7 @@ public int hashCode() { maxConcurrentWriteBatches, maxWriteBufferSize, maxRetryDelay, - idleShardRetryDelay + pollTimeout ); } }