-
Type:
New Feature
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Server Programmability
-
None
-
None
-
None
-
None
-
None
-
None
-
None
In the interest of availability and avoiding crashes when not necessary, some teams (e.g. Cluster Scalability, Query Execution) have been moving away from invariant in favor of tassert in cases where it's not necessary to kill the process from a correctness perspective, even if a condition should be logically impossible.
However, tassert will throw in production builds, even if this is undesirable. This leads to needing to handle the exception at the call site, which is pretty ugly.
I'd like to be able to write something like this:
auto value = tassertOr(something.has_value(), *something, defaultValue);
This would do the following:
- If the first argument evaluates to true, return the second argument, otherwise return the third argument.
- If this is a test build and the first argument evaluates to false, also increment the tripwire assertions count.
"tassertOr" might not be the best name for this. Logically this is more like an invariant with a non-lethal alternative.
- is related to
-
SERVER-114005 Resharding critical section timeout should cancel remaining steps on coordinator
-
- Closed
-