Avoid DocumentSource::getSourceName() in stage type checks

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Execution
    • None
    • 3
    • 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
              Reporter:
              Romans Kasperovics
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: