Do not look up unneeded fields in change stream transform stage

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Minor - P4
    • 8.2.0-rc0
    • Affects Version/s: None
    • Component/s: Change streams
    • None
    • Query Execution
    • Fully Compatible
    • QE 2025-05-12
    • None
    • 3
    • TBD
    • None
    • None
    • None
    • None
    • None
    • None

      change_stream_event_transform.cpp currently performs unconditional lookups of certain fields in the input Document, but the looked-up values will only be used under certain conditions.
      For example this is true for the fields applyOpsIndex and applyOpsTs, which are looked up here, but the looked-up values are only used when preimages are enabled.

      We also unconditionally call MutableDocument::addField(StringData, Value) unconditionally for several fields that may be missing / have no value.
      addField will unconditionally call appendField() on the underlying storage object. And appendField() will unconditionally add the Value to the storage, even if Value::missing() is true.
      This work can be avoided for fields that do not have a value set for them.

            Assignee:
            Jan Steemann
            Reporter:
            Jan Steemann
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: