Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-90031

Prefer comparing command pointers over their names

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0, 8.0.0-rc8
    • Affects Version/s: None
    • Component/s: Internal Code
    • None
    • Service Arch
    • Fully Compatible
    • v8.0
    • Programmability 2024-05-27

      For example, we check if the received command is hello as part of parsing every single database command, and that's done by comparing the command's name:

      ...
      const auto session = _execContext.getOpCtx()->getClient()->session();
      if (session) {
          if (!opCtx->isExhaust() || !isHello()) {
              InExhaustHello::get(session.get())->setInExhaust(false, request.getCommandName());
          }
      }
      ...
      bool isHello() const {
          return _execContext.getCommand()->getName() == "hello"_sd || _execContext.getCommand()->getName() == "isMaster"_sd;
      }
      

      We should use the command's virtual address to perform this comparison.

            Assignee:
            ronald.steinke@mongodb.com Ronald Steinke
            Reporter:
            amirsaman.memaripour@mongodb.com Amirsaman Memaripour
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: