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

Avoid DocumentSource::getSourceName() in stage type checks

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Execution
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      We have many occurrences in the code where we try to determine the class affiliation (a.k.a., isInstanceOf ) of a pointer to a DocumentSource, and there are at least 3 ways to do that:

      1. dynamic cast the pointer to the target type and check if it fails (at least 36 times in master)
      2. compare pointer->getSourceName() with a string constant (at least 18 times in master)
      3. compare pointer->getId() (introduced by SERVER-99019) with an integer constant (at least 2 times in master)

      It would be nice if we had some consistency. Out of 3 methods, the string comparison seems least efficient.

            Assignee:
            Unassigned Unassigned
            Reporter:
            romans.kasperovics@mongodb.com Romans Kasperovics
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              None
              None
              None
              None