Skip to content

Commit

Permalink
Don't serialize backwardCompatibleMessage field from `RepositoryCon…
Browse files Browse the repository at this point in the history
…flictException` in V9 (#122730)

This field was deprecated in V8 and removed in #114726. We don't need to serialize it in V9
  • Loading branch information
arteam authored Feb 17, 2025
1 parent e161ff2 commit fb75dc4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ static TransportVersion def(int id) {
public static final TransportVersion REMOVE_ALL_APPLICABLE_SELECTOR = def(9_009_0_00);
public static final TransportVersion SLM_UNHEALTHY_IF_NO_SNAPSHOT_WITHIN = def(9_010_0_00);
public static final TransportVersion ESQL_SUPPORT_PARTIAL_RESULTS = def(9_011_0_00);
public static final TransportVersion REMOVE_REPOSITORY_CONFLICT_MESSAGE = def(9_012_0_00);

/*
* STOP! READ THIS FIRST! No, really,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

package org.elasticsearch.repositories;

import org.elasticsearch.TransportVersions;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.rest.RestStatus;

import java.io.IOException;
Expand All @@ -29,16 +29,20 @@ public RestStatus status() {
return RestStatus.CONFLICT;
}

@UpdateForV9(owner = UpdateForV9.Owner.DISTRIBUTED_COORDINATION) // drop unneeded string from wire format
public RepositoryConflictException(StreamInput in) throws IOException {
super(in);
in.readString();
if (in.getTransportVersion().before(TransportVersions.REMOVE_REPOSITORY_CONFLICT_MESSAGE)) {
// Deprecated `backwardCompatibleMessage` field
in.readString();
}
}

@Override
@UpdateForV9(owner = UpdateForV9.Owner.DISTRIBUTED_COORDINATION) // drop unneeded string from wire format
protected void writeTo(StreamOutput out, Writer<Throwable> nestedExceptionsWriter) throws IOException {
super.writeTo(out, nestedExceptionsWriter);
out.writeString("");
if (out.getTransportVersion().before(TransportVersions.REMOVE_REPOSITORY_CONFLICT_MESSAGE)) {
// Deprecated `backwardCompatibleMessage` field
out.writeString("");
}
}
}

0 comments on commit fb75dc4

Please sign in to comment.