Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[9.0] Re-remove min compatible version from SearchRequest (#123859) #125093

Merged
merged 1 commit into from
Mar 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ static TransportVersion def(int id) {
public static final TransportVersion REMOVE_ALL_APPLICABLE_SELECTOR_9_0 = def(9_000_0_05);
public static final TransportVersion BYTE_SIZE_VALUE_ALWAYS_USES_BYTES_90 = def(9_000_0_06);
public static final TransportVersion RETRY_ILM_ASYNC_ACTION_REQUIRE_ERROR_90 = def(9_000_0_07);
public static final TransportVersion RE_REMOVE_MIN_COMPATIBLE_SHARD_NODE_90 = def(9_000_0_08);

/*
* STOP! READ THIS FIRST! No, really,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.core.Nullable;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.index.mapper.SourceLoader;
import org.elasticsearch.index.query.QueryRewriteContext;
import org.elasticsearch.index.query.Rewriteable;
Expand Down Expand Up @@ -254,10 +253,8 @@ public SearchRequest(StreamInput in) throws IOException {
finalReduce = true;
}
ccsMinimizeRoundtrips = in.readBoolean();
if ((in.getTransportVersion().before(TransportVersions.REMOVE_MIN_COMPATIBLE_SHARD_NODE)
|| in.getTransportVersion().onOrAfter(TransportVersions.REVERT_REMOVE_MIN_COMPATIBLE_SHARD_NODE)) && in.readBoolean()) {
@UpdateForV9(owner = UpdateForV9.Owner.CORE_INFRA) // this can be removed (again) when the v9 transport version can diverge
Version v = Version.readVersion(in); // and drop on the floor
if (in.getTransportVersion().before(TransportVersions.RE_REMOVE_MIN_COMPATIBLE_SHARD_NODE_90) && in.readBoolean()) {
Copy link
Contributor

@ldematte ldematte Mar 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I am overthinking this, but shouldn't this be more complex?
IF 9.0 can talk with a ES version that is on a version with REVERT_REMOVE_MIN_COMPATIBLE_SHARD_NODE (8.18, unless this is backported to 8.18 too), it needs to take this branch.

So it could be (
before(REMOVE_MIN_COMPATIBLE_SHARD_NODE)
OR
(onOrAfter(REVERT_REMOVE_MIN_COMPATIBLE_SHARD_NODE) && before(RE_REMOVE_MIN_COMPATIBLE_SHARD_NODE_90))?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "old behaviour" is before we removed min compatible, or after we reverted it but before we re-removed it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. The initial remove was immediately reverted before 8.17.3 and never released (except for maybe serverless), from a 9 perspective before RE_REMOVE_MIN_COMPATIBLE_SHARD_NODE_90 the version always existed in the binary protocol.

    public static final TransportVersion INITIAL_ELASTICSEARCH_8_16_6 = def(8_772_0_06);

    public static final TransportVersion REMOVE_MIN_COMPATIBLE_SHARD_NODE = def(8_773_0_00);
    public static final TransportVersion REVERT_REMOVE_MIN_COMPATIBLE_SHARD_NODE = def(8_774_0_00)

    public static final TransportVersion INITIAL_ELASTICSEARCH_8_17_3 = def(8_797_0_03);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The initial remove was immediately reverted before 8.17.3 and never released

Oh I missed that. It makes sense, thank you for checking!

Version.readVersion(in); // and drop on the floor
}
waitForCheckpoints = in.readMap(StreamInput::readLongArray);
waitForCheckpointsTimeout = in.readTimeValue();
Expand Down Expand Up @@ -293,8 +290,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeBoolean(finalReduce);
}
out.writeBoolean(ccsMinimizeRoundtrips);
if (out.getTransportVersion().before(TransportVersions.REMOVE_MIN_COMPATIBLE_SHARD_NODE)
|| out.getTransportVersion().onOrAfter(TransportVersions.REVERT_REMOVE_MIN_COMPATIBLE_SHARD_NODE)) {
if (out.getTransportVersion().before(TransportVersions.RE_REMOVE_MIN_COMPATIBLE_SHARD_NODE_90)) {
out.writeBoolean(false);
}
out.writeMap(waitForCheckpoints, StreamOutput::writeLongArray);
Expand Down