[SERVER-54287] Don't allow unstable fields to have a default value in IDL Created: 04/Feb/21  Updated: 08/Mar/21  Resolved: 08/Mar/21

Status: Closed
Project: Core Server
Component/s: IDL
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Samyukta Lanka Assignee: Samyukta Lanka
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Sprint: Repl 2021-02-22, Repl 2021-03-08, Repl 2021-03-22
Participants:

 Description   

This will cause errors if a command in API V1 uses it and apiStrict is set to true.

We should also explicitly require that unstable fields be optional.



 Comments   
Comment by Samyukta Lanka [ 08/Mar/21 ]

Closing this as won't fix. The way that an unstable field with a default value could manifest as an API Strict error is if the mongos parses the request (thus adding the default parameter) and then turns the parsed request back to BSON to forward to the mongods (who will then fail to parse because the unstable parameter is included with apiStrict=true).

The reason for closing is that there are many places in the code that rely on a default value existing for an unstable parameter, but their command implementation will not run into the issue above (because mongos will not forward the parsed request, but the original request). Requiring them to not have a default value will force us to change the code to support optional parameters. The intent for many of these parameters is to eventually make them stable, in which case when we make the parameter stable, we'd switch back to using a default and have to change the code back to the way it was. This is unnecessary work for commands that don't even run into the original issue. Since a test exists to find these errors, patch builds will fail if there is a new instance of a default value for an unstable parameter that could cause an API Strict Error.

Generated at Thu Feb 08 05:33:07 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.