Support LOGV2 serialization for RuntimeEnvironment and PlanStageData

XMLWordPrintableJSON

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

      Currently classed PlanStageData and RuntimeEnvironment have debugString() methods:

      https://github.com/mongodb/mongo/blame/2ce7d457434f2b81924c32ead1fefce7d9e3a949/src/mongo/db/query/sbe_stage_builder_plan_data.h#L299

      https://github.com/mongodb/mongo/blob/master/src/mongo/db/exec/sbe/expressions/runtime_environment.h#L193

      However, they have different signatures:

      std::string debugString() and 

      void debugString(StringBuilder*).

      RuntimeEnvironment is accepting StringBuilder to avoid extra allocations when serializing it in PlanStageData::debugString().

      What we should do is:

      1. Add serialize(fmt::memory_buffer&) method to both functions. This way they can be serialized to already existing buffer, avoiding allocations and this signature is supported by LOGV2: https://github.com/mongodb/mongo/blob/master/src/mongo/logv2/attribute_storage.h#L173
      2. Add std::string debugString() to both classes, implementing it via serialize(). This way we can keep old signature.

            Assignee:
            [DO NOT USE] Backlog - Query Execution
            Reporter:
            Ivan Fefer
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: