Use symbolic constants in change streams oplog fields access

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Execution
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Several of the change stream execution stages and helper files read fields from the oplog entry by specifying the field names as character literals.

      Example from change_stream_event_transform.cpp:

                  if (auto nssField = oField.getField("drop"); !nssField.missing()) {
      ...
                  } else if (auto nssField = oField.getField("renameCollection"); !nssField.missing()) {
      ...
      

      This works, but we should replace the character literal field names with some symbolic constants, so they can be easier found by code analysis (cross-references) and tools (e.g. grep.

      The following files should be checked and improved if possible:

      • src/mongo/db/pipeline/change_stream_event_transform.cpp
      • src/mongo/db/exec/agg/change_stream_unwind_transaction_stage.cpp
      • src/mongo/db/pipeline/change_stream_filter_helpers.cpp
      • src/mongo/db/pipeline/change_stream_rewrite_helpers.cpp

      The files make most use of the specific oplog field names used by change streams.

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

              Created:
              Updated: