[SERVER-47778] have MONGO_INITIALIZERs throw to indicate failure Created: 27/Apr/20 Updated: 29/Oct/23 Resolved: 08/Dec/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Code |
| Affects Version/s: | None |
| Fix Version/s: | 4.9.0 |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Billy Donahue | Assignee: | Billy Donahue |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | servicearch-wfbf-day | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||
| Sprint: | Service Arch 2020-07-27, Service Arch 2020-08-10, Service Arch 2020-08-24, Service arch 2020-09-07, Service arch 2020-09-21, Service arch 2020-12-14 | ||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Description |
|
Convert initializers to throw DBException if something goes wrong, instead of returning Status. Most of the time they just return OK unconditionally, and that's easier to say with an exception protocol. If any initializer returns a non-OK status, all initialization stops. Basically the process dies right away, and it's a gracefully fatal error to return non-OK status. Most initializers today have a single Status::OK() return statement, providing no information. It's unnecessary. A simple change (already done) replaces all INITIALIZER return Status::OK(), or just deleting it if it's the last statement of the function. All non-OK `return expr` can be replaced with `uassertStatusOK(expr)`. There are 148 little improvements to make.
but more substantial code is improved as well:
becomes
|
| Comments |
| Comment by Billy Donahue [ 08/Dec/20 ] |
|
The two commits (mongo and enterprise) landed in two other tickets. 10gen/mongo-enterprise-modules [master] Author: {'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}Message: mongodb/mongo [master] Author: {'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}Message: Consolidate init-related headers (just init.h and initializer.h) |
| Comment by Billy Donahue [ 01/Dec/20 ] |
|
Revived the code reviews! |
| Comment by Billy Donahue [ 19/Oct/20 ] |
|
I'm only keeping it open for my own reference. It's not an active code review only because there hasn't been a sprint with capacity to land it. |
| Comment by Billy Donahue [ 27/Apr/20 ] |
|
CR: CR (enterprise): |