[SERVER-47933] logv2: detect attribute collisions Created: 04/May/20  Updated: 29/Oct/23  Resolved: 07/Jul/20

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 4.4.1, 4.7.0

Type: Improvement Priority: Major - P3
Reporter: Billy Donahue Assignee: Billy Donahue
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Problem/Incident
Backwards Compatibility: Fully Compatible
Backport Requested:
v4.4
Sprint: Service arch 2020-05-18, Service arch 2020-06-01, Service arch 2020-06-15, Service arch 2020-06-29
Participants:
Linked BF Score: 30

 Description   

Without a check, we could be emitting invalid json as log statements.
Json doesn't allow duplicate object keys.

Hopefully this can be a static check for the majority of LOGV2 statements.



 Comments   
Comment by Githook User [ 19/Aug/20 ]

Author:

{'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}

Message: SERVER-47933 runtime attr unique check

Recommit: handle pre-init testing proctor

(cherry picked from commit 07deced6b3fa2f5927bb33bd4940cc60d6bc4607)
Branch: v4.4
https://github.com/mongodb/mongo/commit/dd0c322ddd022e409bde89e8d3566e67ac166cdc

Comment by Billy Donahue [ 02/Jul/20 ]

PoC on a compile-time check, for reference.

https://mongodbcr.appspot.com/595650004/

need better constexpr access to the ""_attr arguments to go all the way.

Comment by Githook User [ 01/Jul/20 ]

Author:

{'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}

Message: SERVER-47933 runtime attr unique check

Recommit: handle pre-init testing proctor
Branch: master
https://github.com/mongodb/mongo/commit/07deced6b3fa2f5927bb33bd4940cc60d6bc4607

Comment by Githook User [ 01/Jul/20 ]

Author:

{'name': 'Pierlauro Sciarelli', 'email': 'pierlauro.sciarelli@mongodb.com', 'username': 'pierlauro'}

Message: Revert "SERVER-47933 runtime attr unique check"

This reverts commit 8b2211d9a7b52a3ff951e9043966bbca3c555c30.
Branch: master
https://github.com/mongodb/mongo/commit/51d7101f5eeee0c1b26dd0c035be47effc6373b7

Comment by Githook User [ 30/Jun/20 ]

Author:

{'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}

Message: SERVER-47933 runtime attr unique check
Branch: master
https://github.com/mongodb/mongo/commit/8b2211d9a7b52a3ff951e9043966bbca3c555c30

Comment by Billy Donahue [ 26/Jun/20 ]

CR: https://mongodbcr.appspot.com/621080001/

Comment by Billy Donahue [ 26/Jun/20 ]

Another potential wrinkle here. We want our logs to be valid JSON. The point of this ticket is that an object with duplicate keys is invalid JSON. We can write some code here to catch mistakes in our "key"_attr syntax in LOGV2 statements. That's all good. But to be really airtight, we'd have to also check the structure of the objects we attach to those attribute keys. BSONObj values might still potentially have duplicate keys, and we might need a strategy for handling those.

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