mirror of https://github.com/mongodb/mongo
SERVER-109502 clarify fassert docs and claim exception_architecture.md for Server Programmability (#40280)
Co-authored-by: Mathias Stearn <mathias@mongodb.com> GitOrigin-RevId: 81598169837ddb20bfc07024154e7e8358d0d0dd
This commit is contained in:
parent
dd1b6942b9
commit
6fc33e8a55
|
|
@ -277,6 +277,7 @@ WORKSPACE.bazel @10gen/devprod-build @svc-auto-approve-bot
|
|||
# The following patterns are parsed from ./docs/OWNERS.yml
|
||||
/docs/**/building.md @10gen/devprod-build @svc-auto-approve-bot
|
||||
/docs/**/cpp_style.md @10gen/server-programmability @svc-auto-approve-bot
|
||||
/docs/**/exception_architecture.md @10gen/server-programmability @svc-auto-approve-bot
|
||||
/docs/**/idl.md @10gen/server-programmability @svc-auto-approve-bot
|
||||
/docs/**/poetry_execution.md @10gen/devprod-correctness @svc-auto-approve-bot
|
||||
/docs/**/linting.md @10gen/devprod-build @svc-auto-approve-bot
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@ filters:
|
|||
- "cpp_style.md":
|
||||
approvers:
|
||||
- 10gen/server-programmability
|
||||
- "exception_architecture.md":
|
||||
approvers:
|
||||
- 10gen/server-programmability
|
||||
- "idl.md":
|
||||
approvers:
|
||||
- 10gen/server-programmability
|
||||
|
|
|
|||
|
|
@ -62,7 +62,11 @@ mistakenly using these assertions midway through mutating process state.
|
|||
|
||||
`fassert` failures will terminate the entire process; this is used for low-level checks where
|
||||
continuing might lead to corrupt data or loss of data on disk. Additionally, `fassert` will log
|
||||
the assertion message with fatal severity and add a breakpoint before terminating.
|
||||
a generic assertion message with fatal severity and add a breakpoint before terminating.
|
||||
|
||||
To log a custom assertion message and terminate the server, use `LOGV2_FATAL`.
|
||||
To avoid printing a stacktrace on failure use `fassertNoTrace` or `LOGV2_FATAL_NO_TRACE`.
|
||||
Consider using them if there is only one way to reach this fatal point in code.
|
||||
|
||||
`tassert` will fail the operation like `uassert`, but also triggers a "deferred-fatality tripwire
|
||||
flag". In testing environments, if the tripwire flag is set during shutdown, the process will
|
||||
|
|
|
|||
|
|
@ -427,6 +427,9 @@ constexpr T checkNoTrace(MsgId msgid,
|
|||
* Each `fassert` call site must have a unique `msgid` as the first argument.
|
||||
* These are chosen using the same convention as logv2 log IDs.
|
||||
*
|
||||
* To log a custom assert message with process-fatal semantics, use LOGV2_FATAL.
|
||||
* Consider using this variant if there is only one way to reach the fatal point in code.
|
||||
*
|
||||
* The second argument is a condition. `fassert` invocations are forwarded to an
|
||||
* overload set of handlers such that it can accept a `bool`, `const Status&`,
|
||||
* or `StatusWith` as a condition.
|
||||
|
|
@ -450,6 +453,8 @@ constexpr T checkNoTrace(MsgId msgid,
|
|||
/**
|
||||
* Same usage and arguments as `fassert`, but performs
|
||||
* a quickExit instead of a stacktrace-dumping abort.
|
||||
* Use LOGV2_FATAL_NO_TRACE to supply a custom error message.
|
||||
* Consider using this variant if there is only one way to reach the fatal point in code.
|
||||
*/
|
||||
#define fassertNoTrace MONGO_fassertNoTrace
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue