Skip to content

Commit 094a815

Browse files
authored
Add @UpdateForV9 annotations to PutStoredScriptRequest (#117582)
We can remove some fields from `PutStoredScriptRequest` once the v9.0 transport protocol can deviate from the v8.last one. This commit adds reminder annotations to do this. Relates #117566
1 parent f05c9b0 commit 094a815

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/PutStoredScriptRequest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.elasticsearch.common.xcontent.XContentHelper;
1919
import org.elasticsearch.core.Nullable;
2020
import org.elasticsearch.core.TimeValue;
21+
import org.elasticsearch.core.UpdateForV9;
2122
import org.elasticsearch.script.StoredScriptSource;
2223
import org.elasticsearch.xcontent.ToXContentFragment;
2324
import org.elasticsearch.xcontent.XContentBuilder;
@@ -36,8 +37,20 @@ public class PutStoredScriptRequest extends AcknowledgedRequest<PutStoredScriptR
3637
@Nullable
3738
private final String context;
3839

40+
/*
41+
* [NOTE: unused fields #117566]
42+
* As of #117566 (8.18) the content and xContentType fields are basically unused, except that we use content().length() for some
43+
* validation. However, in earlier 8.x versions they did at least influence the output of toString(). That means in 9.x we can replace
44+
* these fields with an int representing the original content length once the 9.x transport protocol can diverge from the 8.x one. For
45+
* BwC with 8.18 we can simply send any BytesReference of the appropriate length.
46+
*/
47+
48+
@UpdateForV9(owner = UpdateForV9.Owner.CORE_INFRA) // see [NOTE: unused fields #117566]
3949
private final BytesReference content;
50+
51+
@UpdateForV9(owner = UpdateForV9.Owner.CORE_INFRA) // see [NOTE: unused fields #117566]
4052
private final XContentType xContentType;
53+
4154
private final StoredScriptSource source;
4255

4356
public PutStoredScriptRequest(StreamInput in) throws IOException {

0 commit comments

Comments
 (0)