Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-3676

Investigate changes in SERVER-71453: Change count command from BasicCommand to IDL typed command

    • Type: Icon: Investigation Investigation
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Tools and Replicator
    • 17

      Original Downstream Change Summary

      There has been a minor change in error codes.
      If the value of the `count` field in the request is not a well-formed UUID or NSS, the count command previously returned an `ErrorCodes.InvalidNamespace` error.
      As part of the change to IDL validation, the command now returns an `ErrorCodes::TypeMismatch` error in this case.
      The error code does not change for well-formed NSS or UUID values which point to non-existing databases/collections.

      Description of Linked Ticket

      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. 

            Assignee:
            Unassigned Unassigned
            Reporter:
            backlog-server-pm Backlog - Core Eng Program Management Team
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: