[SERVER-29412] make the movePrimary command use the IDL Created: 31/May/17  Updated: 30/Oct/23  Resolved: 08/Jun/17

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 3.5.8
Fix Version/s: 3.5.9

Type: Task Priority: Major - P3
Reporter: Esha Maharishi (Inactive) Assignee: Jessica Yu
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Sharding 2017-06-19
Participants:

 Description   

The IDL allows for serializing/deserializing to and from BSON objects (in the server codebase, these BSON objects are instances of a class called BSONObj, which implements the BSON spec).

All commands extend the Command class, which extends the Command interface. Particularly, each class that extends Command must implement the run() method. And the run() method takes the command's arguments in serialized BSONObj form, in a parameter called cmdObj.

The run() method of most commands then directly accesses cmdObj to extract arguments and perform validation. Since this is both a lot of boilerplate code and hard to get right, the server team is developing an IDL (Interface Definition Language) for the 3.6 release of MongoDB. The IDL allows you to succinctly specify the shape of a type in an .idl file, and on compilation, a class with the appropriate methods to deserialize and serialize a BSONObj into that logical type is automatically generated (that is, the .h and .cpp files for the class, which contain the parser, getters, and setters, are generated and placed in the 'build' directory).

This ticket should make the movePrimary command (source code, online documentation) command use the IDL.

A similar task was done for shardCollection under SERVER-29106. Feel free to look at the changes in that commit, as well as the current code in

to get an idea of how to integrate the IDL into the movePrimary command.



 Comments   
Comment by Githook User [ 12/Jun/17 ]

Author:

{u'name': u'Jessica Yu', u'email': u'jessicayu@MacBook-Pro-51.local'}

Message: SERVER-29412 make the movePrimary command use the IDL
Branch: master
https://github.com/mongodb/mongo/commit/3cdf41866ecfec266f18c201ad9fcbca901d6945

Generated at Thu Feb 08 04:20:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.