[SERVER-60349] Make IDL compatibility checker allow addition of fields with type 'optionalBool' Created: 30/Sep/21  Updated: 29/Oct/23  Resolved: 10/Jan/22

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

Type: Bug Priority: Major - P3
Reporter: Arun Banala Assignee: Romans Kasperovics
Resolution: Fixed Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-61551 IDL compatibility checker should chec... Closed
related to SERVER-56387 Check optionalBool-typed IDL fields f... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

The IDL compatibility checker currently disallows addition of new mandatory fields to API version 1 commands. The compatibility checker seemed to assume that 'optionalBool' is a mandatory field because we don't specify 'optional:true' in the field specification. But the 'optionalBool' as the name suggests is not a mandatory field and can be allowed.



 Comments   
Comment by Githook User [ 06/Jan/22 ]

Author:

{'name': 'Romans Kasperovics', 'email': 'romans.kasperovics@mongodb.com', 'username': 'romanskas'}

Message: SERVER-60349 Allow adding optionalBool fields in IDL compatibility check
Branch: master
https://github.com/mongodb/mongo/commit/9ce5ff8c50813185e3c7c4351ca775461022ca0e

Comment by Romans Kasperovics [ 22/Dec/21 ]

Just a general observation: optionalBool is a bit controversial and confusing, because of the existence of the "optional" field in the IDL. In theory one can specify

newField:
    type: optionalBool
    optional: false

If my understanding is correct, the main problem optionalBool is trying to solve is that the C++ representation of bool(optional) is still bool, which has only 2 value options.

IMHO a more consistent alternative would be to automatically adding optional<...> to all C++ representations for optional: true and without default.

Comment by Kyle Suarez [ 19/Oct/21 ]

According to sebastien.mendez, if we do SERVER-56387 then this will be obviated.

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