Skip to content

Commit 241ee00

Browse files
committed
Don't serialize backwardCompatibleMessage field from RepositoryConflictException in V9
This field was deprecated in V8 and removed in #114726. We don't need to serialize it in V9
1 parent 54eab9d commit 241ee00

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

server/src/main/java/org/elasticsearch/TransportVersions.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ static TransportVersion def(int id) {
195195
public static final TransportVersion REMOVE_ALL_APPLICABLE_SELECTOR = def(9_009_0_00);
196196
public static final TransportVersion SLM_UNHEALTHY_IF_NO_SNAPSHOT_WITHIN = def(9_010_0_00);
197197
public static final TransportVersion ESQL_SUPPORT_PARTIAL_RESULTS = def(9_011_0_00);
198+
public static final TransportVersion REMOVE_REPOSITORY_CONFLICT_MESSAGE = def(9_012_0_00);
198199

199200
/*
200201
* STOP! READ THIS FIRST! No, really,

server/src/main/java/org/elasticsearch/repositories/RepositoryConflictException.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
package org.elasticsearch.repositories;
1111

12+
import org.elasticsearch.TransportVersions;
1213
import org.elasticsearch.common.io.stream.StreamInput;
1314
import org.elasticsearch.common.io.stream.StreamOutput;
14-
import org.elasticsearch.core.UpdateForV9;
1515
import org.elasticsearch.rest.RestStatus;
1616

1717
import java.io.IOException;
@@ -29,16 +29,20 @@ public RestStatus status() {
2929
return RestStatus.CONFLICT;
3030
}
3131

32-
@UpdateForV9(owner = UpdateForV9.Owner.DISTRIBUTED_COORDINATION) // drop unneeded string from wire format
3332
public RepositoryConflictException(StreamInput in) throws IOException {
3433
super(in);
35-
in.readString();
34+
if (in.getTransportVersion().before(TransportVersions.REMOVE_REPOSITORY_CONFLICT_MESSAGE)) {
35+
// Deprecated `backwardCompatibleMessage` field
36+
in.readString();
37+
}
3638
}
3739

3840
@Override
39-
@UpdateForV9(owner = UpdateForV9.Owner.DISTRIBUTED_COORDINATION) // drop unneeded string from wire format
4041
protected void writeTo(StreamOutput out, Writer<Throwable> nestedExceptionsWriter) throws IOException {
4142
super.writeTo(out, nestedExceptionsWriter);
42-
out.writeString("");
43+
if (out.getTransportVersion().before(TransportVersions.REMOVE_REPOSITORY_CONFLICT_MESSAGE)) {
44+
// Deprecated `backwardCompatibleMessage` field
45+
out.writeString("");
46+
}
4347
}
4448
}

0 commit comments

Comments
 (0)