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

Gate reading of optional string array for bwc #106878

Merged
merged 20 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ static TransportVersion def(int id) {
public static final TransportVersion ML_INFERENCE_EMBEDDING_BYTE_ADDED = def(8_615_00_0);
public static final TransportVersion ML_INFERENCE_L2_NORM_SIMILARITY_ADDED = def(8_616_00_0);
public static final TransportVersion SEARCH_NODE_LOAD_AUTOSCALING = def(8_617_00_0);
public static final TransportVersion DIMENSIONS_SERIALIZATION_PERSISTENT_TASK = def(8_618_00_0);

/*
* STOP! READ THIS FIRST! No, really,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,17 @@ class DownsampleShardIndexer {

public DownsampleIndexerAction.ShardDownsampleResponse execute() throws IOException {
final Query initialStateQuery = createQuery();
if (this.dimensions == null || this.dimensions.length <= 0) {
dnhatn marked this conversation as resolved.
Show resolved Hide resolved
final String errorMessage = "Downsampling task ["
+ task.getPersistentTaskId()
+ "] on shard "
+ indexShard.shardId()
+ " failed because of missing dimensions for index ["
+ task.getDownsampleIndex()
+ "]";
logger.error(errorMessage);
throw new DownsampleShardIndexerException(errorMessage, false);
}
if (initialStateQuery instanceof MatchNoDocsQuery) {
return new DownsampleIndexerAction.ShardDownsampleResponse(indexShard.shardId(), task.getNumIndexed());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ public record DownsampleShardTaskParams(
new ShardId(in),
in.readStringArray(),
in.readStringArray(),
in.readOptionalStringArray()
in.getTransportVersion().onOrAfter(TransportVersions.DIMENSIONS_SERIALIZATION_PERSISTENT_TASK)
? in.readOptionalStringArray()
: new String[] {}
dnhatn marked this conversation as resolved.
Show resolved Hide resolved
);
}

Expand Down Expand Up @@ -108,7 +110,9 @@ public void writeTo(StreamOutput out) throws IOException {
shardId.writeTo(out);
out.writeStringArray(metrics);
out.writeStringArray(labels);
out.writeOptionalStringArray(dimensions);
if (out.getTransportVersion().onOrAfter(TransportVersions.DIMENSIONS_SERIALIZATION_PERSISTENT_TASK)) {
out.writeOptionalStringArray(dimensions);
}
dnhatn marked this conversation as resolved.
Show resolved Hide resolved
}

public static DownsampleShardTaskParams fromXContent(XContentParser parser) throws IOException {
Expand Down