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

Update version check for context to comply with backport #15572

Merged
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 @@ -13,6 +13,7 @@
import static org.opensearch.OpenSearchException.UNKNOWN_VERSION_ADDED;
import static org.opensearch.Version.V_2_10_0;
import static org.opensearch.Version.V_2_13_0;
import static org.opensearch.Version.V_2_17_0;
import static org.opensearch.Version.V_2_1_0;
import static org.opensearch.Version.V_2_4_0;
import static org.opensearch.Version.V_2_5_0;
Expand Down Expand Up @@ -1206,7 +1207,7 @@ public static void registerExceptions() {
org.opensearch.indices.InvalidIndexContextException.class,
org.opensearch.indices.InvalidIndexContextException::new,
174,
V_3_0_0
V_2_17_0
)
);
registerExceptionHandle(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public CreateIndexRequest(StreamInput in) throws IOException {
aliases.add(new Alias(in));
}
waitForActiveShards = ActiveShardCount.readFrom(in);
if (in.getVersion().onOrAfter(Version.V_3_0_0)) {
if (in.getVersion().onOrAfter(Version.V_2_17_0)) {
context = in.readOptionalWriteable(Context::new);
}
}
Expand Down Expand Up @@ -632,7 +632,7 @@ public void writeTo(StreamOutput out) throws IOException {
alias.writeTo(out);
}
waitForActiveShards.writeTo(out);
if (out.getVersion().onOrAfter(Version.V_3_0_0)) {
if (out.getVersion().onOrAfter(Version.V_2_17_0)) {
out.writeOptionalWriteable(context);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public GetIndexResponse(
}
dataStreams = Collections.unmodifiableMap(dataStreamsMapBuilder);

if (in.getVersion().onOrAfter(Version.V_3_0_0)) {
if (in.getVersion().onOrAfter(Version.V_2_17_0)) {
final Map<String, Context> contextMapBuilder = new HashMap<>();
int contextSize = in.readVInt();
for (int i = 0; i < contextSize; i++) {
Expand Down Expand Up @@ -297,7 +297,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeOptionalString(indexEntry.getValue());
}

if (out.getVersion().onOrAfter(Version.V_3_0_0)) {
if (out.getVersion().onOrAfter(Version.V_2_17_0)) {
out.writeVInt(contexts.size());
for (final Map.Entry<String, Context> indexEntry : contexts.entrySet()) {
out.writeString(indexEntry.getKey());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ private static class IndexMetadataDiff implements Diff<IndexMetadata> {
);
rolloverInfos = DiffableUtils.readJdkMapDiff(in, DiffableUtils.getStringKeySerializer(), ROLLOVER_INFO_DIFF_VALUE_READER);
isSystem = in.readBoolean();
if (in.getVersion().onOrAfter(Version.V_3_0_0)) {
if (in.getVersion().onOrAfter(Version.V_2_17_0)) {
context = in.readOptionalWriteable(Context::new);
} else {
context = null;
Expand All @@ -1153,7 +1153,7 @@ public void writeTo(StreamOutput out) throws IOException {
inSyncAllocationIds.writeTo(out);
rolloverInfos.writeTo(out);
out.writeBoolean(isSystem);
if (out.getVersion().onOrAfter(Version.V_3_0_0)) {
if (out.getVersion().onOrAfter(Version.V_2_17_0)) {
out.writeOptionalWriteable(context);
}
}
Expand Down Expand Up @@ -1218,7 +1218,7 @@ public static IndexMetadata readFrom(StreamInput in) throws IOException {
}
builder.system(in.readBoolean());

if (in.getVersion().onOrAfter(Version.V_3_0_0)) {
if (in.getVersion().onOrAfter(Version.V_2_17_0)) {
builder.context(in.readOptionalWriteable(Context::new));
}
return builder.build();
Expand Down Expand Up @@ -1259,7 +1259,7 @@ public void writeTo(StreamOutput out) throws IOException {
}
out.writeBoolean(isSystem);

if (out.getVersion().onOrAfter(Version.V_3_0_0)) {
if (out.getVersion().onOrAfter(Version.V_2_17_0)) {
out.writeOptionalWriteable(context);
}
}
Expand Down
Loading