Skip to content

Commit 547bcd3

Browse files
committed
Adjust versions for settings in follower requests
We recently added the ability for auto follow patterns and follower requests to include settings overrides. This commit adjusts the serialization versions on these requests.
1 parent 9920396 commit 547bcd3

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
package org.elasticsearch.xpack.core.ccr.action;
77

8+
import org.elasticsearch.Version;
89
import org.elasticsearch.action.ActionRequestValidationException;
910
import org.elasticsearch.action.ActionType;
1011
import org.elasticsearch.action.support.master.AcknowledgedRequest;
@@ -159,7 +160,9 @@ public Request(StreamInput in) throws IOException {
159160
remoteCluster = in.readString();
160161
leaderIndexPatterns = in.readStringList();
161162
followIndexNamePattern = in.readOptionalString();
162-
settings = Settings.readSettingsFromStream(in);
163+
if (in.getVersion().onOrAfter(Version.V_7_9_0)) {
164+
settings = Settings.readSettingsFromStream(in);
165+
}
163166
parameters = new FollowParameters(in);
164167
}
165168

@@ -170,7 +173,9 @@ public void writeTo(StreamOutput out) throws IOException {
170173
out.writeString(remoteCluster);
171174
out.writeStringCollection(leaderIndexPatterns);
172175
out.writeOptionalString(followIndexNamePattern);
173-
Settings.writeSettingsToStream(settings, out);
176+
if (out.getVersion().onOrAfter(Version.V_7_9_0)) {
177+
Settings.writeSettingsToStream(settings, out);
178+
}
174179
parameters.writeTo(out);
175180
}
176181

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
package org.elasticsearch.xpack.core.ccr.action;
88

9+
import org.elasticsearch.Version;
910
import org.elasticsearch.action.ActionRequestValidationException;
1011
import org.elasticsearch.action.ActionResponse;
1112
import org.elasticsearch.action.ActionType;
@@ -173,7 +174,9 @@ public Request(StreamInput in) throws IOException {
173174
this.remoteCluster = in.readString();
174175
this.leaderIndex = in.readString();
175176
this.followerIndex = in.readString();
176-
this.settings = Settings.readSettingsFromStream(in);
177+
if (in.getVersion().onOrAfter(Version.V_7_9_0)) {
178+
this.settings = Settings.readSettingsFromStream(in);
179+
}
177180
this.parameters = new FollowParameters(in);
178181
waitForActiveShards(ActiveShardCount.readFrom(in));
179182
}
@@ -184,7 +187,9 @@ public void writeTo(StreamOutput out) throws IOException {
184187
out.writeString(remoteCluster);
185188
out.writeString(leaderIndex);
186189
out.writeString(followerIndex);
187-
Settings.writeSettingsToStream(settings, out);
190+
if (out.getVersion().onOrAfter(Version.V_7_9_0)) {
191+
Settings.writeSettingsToStream(settings, out);
192+
}
188193
parameters.writeTo(out);
189194
waitForActiveShards.writeTo(out);
190195
}

0 commit comments

Comments
 (0)