[SERVER-7546] Unify Status and Uassert Integer Code Spaces Created: 03/Nov/12  Updated: 23/Feb/23

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

Type: Improvement Priority: Major - P3
Reporter: Andy Schwerin Assignee: Backlog - Service Architecture
Resolution: Unresolved Votes: 0
Labels: platforms-re-triaged
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-11095 getAllSourceFiles doesn't get all sou... Closed
Assigned Teams:
Service Arch
Participants:

 Description   

To unify the space of error codes from uasserts and error_codes, error_codes.err codes other than OK must start at 1 and not exceed 3,999. These are the "semantically meaningful error codes", and along with OK (0) are the only values that mongo servers should examine for decision making purposes.

0 remains an invalid uassert code, and is the "OK" code for Statuses. 0 means no error in both spaces and the unified space.

4,000-8,999 are "location codes" for the subscription build.

10,000+ are "location codes" for code common to the subscription and free builds.

Once we unify the two error code spaces as described abvoe, we should get rid of the "location" code in Status. When a command wishes to return a status, it does so as follows:

{ ok: 1, code: <status code>, errmsg: <reason string>, ... }

If the code is 0/OK, there is no errmsg.

Optionally, the command may include codeString, with the string name of the code. Commands may return extra information as they require.

All codes with semantic meaning, as opposed to location-identifying meaning, must be defined in src/mongo/base/error_codes.err. Further, after this issue is resolved, error_codes.err must be append-only. This allows driver writers to pull https://github.com/mongodb/mongo/blob/master/src/mongo/base/error_codes.err whenever they wish (at driver build time?) and use it to auto-generate a language-specific error codes module.

The header comment for buildscripts/errorcodes.py should document this.



 Comments   
Comment by Lauren Lewis (Inactive) [ 24/Feb/22 ]

We haven’t heard back from you for at least one calendar year, so this issue is being closed. If this is still an issue for you, please provide additional information and we will reopen the ticket.

Comment by J Rassi [ 23/Jan/13 ]

Linking to commit.

"SERVER-7546 Assign location codes to errors not yet assigned"
https://github.com/10gen/mongo-enterprise-modules/commit/fba21f54f3ea3aee07e6606e26a5cca5b683b426

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