Skip to content

Commit 8739603

Browse files
committed
Clean up RepositoryConflictException wire protocol
Removes string that became unused in #114726.
1 parent 24afbe3 commit 8739603

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-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
@@ -196,6 +196,7 @@ static TransportVersion def(int id) {
196196
public static final TransportVersion REMOVE_ALL_APPLICABLE_SELECTOR = def(9_009_0_00);
197197
public static final TransportVersion SLM_UNHEALTHY_IF_NO_SNAPSHOT_WITHIN = def(9_010_0_00);
198198
public static final TransportVersion ESQL_SUPPORT_PARTIAL_RESULTS = def(9_011_0_00);
199+
public static final TransportVersion REPO_CONFLICT_EXCEPTION_UNUSED_STRING = def(9_012_0_00);
199200

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

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111

1212
import org.elasticsearch.common.io.stream.StreamInput;
1313
import org.elasticsearch.common.io.stream.StreamOutput;
14-
import org.elasticsearch.core.UpdateForV9;
1514
import org.elasticsearch.rest.RestStatus;
1615

1716
import java.io.IOException;
1817

18+
import static org.elasticsearch.TransportVersions.REPO_CONFLICT_EXCEPTION_UNUSED_STRING;
19+
1920
/**
2021
* Repository conflict exception
2122
*/
@@ -29,16 +30,18 @@ public RestStatus status() {
2930
return RestStatus.CONFLICT;
3031
}
3132

32-
@UpdateForV9(owner = UpdateForV9.Owner.DISTRIBUTED_COORDINATION) // drop unneeded string from wire format
3333
public RepositoryConflictException(StreamInput in) throws IOException {
3434
super(in);
35-
in.readString();
35+
if (in.getTransportVersion().before(REPO_CONFLICT_EXCEPTION_UNUSED_STRING)) {
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(REPO_CONFLICT_EXCEPTION_UNUSED_STRING)) {
44+
out.writeString("");
45+
}
4346
}
4447
}

0 commit comments

Comments
 (0)