[SERVER-82813] GDB pretty printer error with FieldProjectionMap Created: 06/Nov/23  Updated: 07/Nov/23

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

Type: Bug Priority: Major - P3
Reporter: Timour Katchaounov Assignee: Backlog - Query Optimization
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query Optimization
Operating System: ALL
Steps To Reproduce:
  • run mongod with forceBonsai
  • set a breakpoint in implementers.cpp:929, this line:
    • builder.make<PhysicalScanNode>(baseCE, fieldProjectionMap, scanDefName, canUseParallelScan);
  • (gdb) p fieldProjectionMap
Participants:

 Description   

When printing a FieldProjectionMap the CQF pretty printer fails as follows:

(gdb) p fieldProjectionMap
$20 = Traceback (most recent call last):
  File "buildscripts/gdb/optimizer_printers.py", line 611, in to_string
    res += "<empty>" if field_projections["size_"] == 0 else str(field_projections).split(
gdb.error: There is no member or method named size_.



 Comments   
Comment by Timour Katchaounov [ 06/Nov/23 ]

The most likely reason is that in class

 

class FieldProjectionMapPrinter(object):
    """Pretty-printer for FieldProjectionMap."""
    def __init__(self, val):
        """Initialize FieldProjectionMapPrinter."""
        self.val = val
    @staticmethod
    def display_hint():
        """Display hint."""
        return None
    def to_string(self):
        rid_proj = self.val["_ridProjection"]
        root_proj = self.val["_rootProjection"]
        res = "{"
        if get_boost_optional(rid_proj) is not None:
            res += "<rid>: " + str(rid_proj) + ", "
        if get_boost_optional(root_proj) is not None:
            res += "<root>: " + str(root_proj) + ", "
        # Rely on default printer for std::set, but remove the extra metadata at the start.
        field_projections = self.val["_fieldProjections"]
        res += "<empty>" if field_projections["size_"] == 0 else str(field_projections).split(
            "elems  =")[-1]
        res += "}"
        return res

 

The to_sting method attempts to reference field_projections["size_"], but std::map has no such member. Map size has to be calculated.

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