[SERVER-49153] Fix the policy used by "errorcodes.py" Created: 26/Jun/20  Updated: 29/Oct/23  Resolved: 23/Jun/22

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 6.1.0-rc0

Type: Improvement Priority: Major - P3
Reporter: Amirsaman Memaripour Assignee: Alex Li
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-48719 Expand Documentation for Server-Inter... Closed
is related to SERVER-49151 Fix malformed LOGV2 and assertion IDs Closed
Backwards Compatibility: Fully Compatible
Sprint: Service Arch 2022-06-13, Service Arch 2022-06-27, Service Arch 2022-07-11
Participants:
Story Points: 1

 Description   

The script currently suggests new IDs for logs and assertions:

(python3-venv) ubuntu@vm:~/mongo$ python buildscripts/errorcodes.py
ok: True
next: 8423348

Also, it doesn't check for IDs used by iasserts.

We should change errorcodes.py to check for IDs used by internal assertions (see here) and modify the script so that it doesn't recommend new IDs unless a ticket number is provided.

It's recommended to useĀ buildscripts/errorcodes.py to choose new IDs for assertions and ErrorCodes. Internally, the script scans the code for the maximum ID used by all assertions, error codes, and LOGV2 log identifiers. Then it increments the maximum by one and returns it as the recommended ID for new assertions and ErrorCodes.

However, this approach is very error-prone. It heavily relies on the IDs picked by programmers, and does not follow any of the already defined rules for choosing identifiers (e.g., the LOGV2 documentation for using SERVER ticket numbers to construct log IDs).

We need to define a clear policy for picking IDs and update errorcodes.py to honor the new policy.



 Comments   
Comment by Githook User [ 21/Jun/22 ]

Author:

{'name': 'Alex Li', 'email': 'alex.li@mongodb.com', 'username': 'lia394126'}

Message: SERVER-49153 Fix the policy used by errorcodes.py
Branch: master
https://github.com/mongodb/mongo/commit/765e3c89b711b071d3bfa3ec9a0b5b4daf8a97c4

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