[SERVER-56626] GDB pretty printer for RecordId Created: 04/May/21  Updated: 29/Oct/23  Resolved: 15/Jun/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 5.0.0-rc2, 5.1.0-rc0

Type: Improvement Priority: Major - P3
Reporter: Louis Williams Assignee: Louis Williams
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Backwards Compatibility: Fully Compatible
Backport Requested:
v5.0
Sprint: Execution Team 2021-06-28
Participants:

 Description   

The internal format of RecordId is an encoded char array and it isn't very readable. Create a pretty printer to aid in debugging.



 Comments   
Comment by Vivian Ge (Inactive) [ 06/Oct/21 ]

Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it’s been triggered. For more active release information, please keep an eye on #server-release. Thank you!

Comment by Githook User [ 16/Jun/21 ]

Author:

{'name': 'Louis Williams', 'email': 'louis.williams@mongodb.com', 'username': 'louiswilliams'}

Message: SERVER-56626 RecordId GDB pretty printer

(cherry picked from commit 6abf79a4a8ae87059fb6a1fdc14d34a4bc59d1ff)
Branch: v5.0
https://github.com/mongodb/mongo/commit/3fae1b46947a58618e1f1f68e0ca8ba85d499ef8

Comment by Githook User [ 16/Jun/21 ]

Author:

{'name': 'Louis Williams', 'email': 'louis.williams@mongodb.com', 'username': 'louiswilliams'}

Message: SERVER-56626 RecordId GDB pretty printer
Branch: SERVER-34632
https://github.com/mongodb/mongo/commit/6abf79a4a8ae87059fb6a1fdc14d34a4bc59d1ff

Comment by Githook User [ 15/Jun/21 ]

Author:

{'name': 'Louis Williams', 'email': 'louis.williams@mongodb.com', 'username': 'louiswilliams'}

Message: SERVER-56626 RecordId GDB pretty printer
Branch: master
https://github.com/mongodb/mongo/commit/6abf79a4a8ae87059fb6a1fdc14d34a4bc59d1ff

Comment by Kaloian Manassiev [ 06/May/21 ]

Yes, only the fields that are named in the structure would be pretty-printed, but the rest would still stay as binary. So I guess pretty-printing at GDB level is the most suitable approach.

Comment by Louis Williams [ 05/May/21 ]

kaloian.manassiev I didn't consider that, but I think only the format byte (the last byte) would be capable of using bit fields, right?

As far as other alternatives, I did use a union in the first iteration of the implementation. However, I settled on the char array because it made the code implementation slightly less complex. More importantly, since the size of RecordId matters considerably (it's passed by value everywhere), it made it easier to guarantee the size of the struct without having to use #pragma pack everywhere to force the layout. Additionally, even with a union, RecordIds that store a byte string would still be char arrays, so pretty printing would still be desired.

Comment by Kaloian Manassiev [ 05/May/21 ]

Just curious, instead of adding a pretty-printer, does it make more sense to convert that byte array into a bit-fields structure instead of using bit arithmetic? That way the debugger will print it nicely naturally.

Generated at Thu Feb 08 05:39:46 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.