[SERVER-84092] Support LOGV2 serialization for RuntimeEnvironment and PlanStageData Created: 12/Dec/23  Updated: 13/Dec/23

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Ivan Fefer Assignee: Backlog - Query Execution
Resolution: Unresolved Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query Execution
Participants:

 Description   

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.

Generated at Thu Feb 08 06:54:02 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.