[SERVER-71453] Change count command from BasicCommand to IDL typed command Created: 17/Nov/22  Updated: 30/Jan/24

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

Type: Task Priority: Major - P3
Reporter: Sophia Tan Assignee: Backlog - Query Execution
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query Execution
Participants:

 Description   

Today, the count command is a BasicCommand. We are going to change it to IDL typed command for the following reason:

  • To pass in tenant information. There is no way to access the original request's validate tenant scope from run() function of BasicCommand. We need the tenant information to have the internal generated aggregation request run correctly.
  • To have the right access contractor for this command. BasicCommand has empty access contractor. But, count command as a version 1 stable api, it should have an access contractor which is defined in its idl file.

We should consider the following points when we doing this. 

  • the reply object. Currently, in count_command.idl, the reply type is OkReply. It's not correct as counter command should return "n" field in reply message.
  • the data type for "n" field. Currently, it's serialized with appendNumber function which can serialize data into either 32 bit int or 64 bit int. We should keep this behavior so that we will not break driver and user's code. But, the IDL compiler has no any type matching this requirement. Need more investigation on how to do it.
  • the impact on api compatibility as we need to add a  new access check item to the access check list. It's "should_ignore_auth_checks" as `count` command calls the function `shouldIgnoreAuthChecks. 
  • some unit test and jstest files will be impacted if they pass in an invalid count request as IDL parser checks request body more carefully. 


 Comments   
Comment by Didier Nadeau [ 21/Nov/23 ]

Hi Query-Execution, we discovered in the NTDI project that the Count command use the legacy BasicCommand format. We think it could be valuable to update it to the new format to reduce maintenance burden going forward. I'm assigning this to your team so you can consider the request and either prioritize or close it.

Generated at Thu Feb 08 06:19:03 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.