Summary
When wiredtiger returns an error code from the API we should consider incrementing a statistic which is specific to that error code. E.g. when wiredtiger returns EINVAL we increment wiredtiger_einval_returned. Obviously it would be difficult to do this for every error code so we'll also have a catch all increment.
This should help with diagnosing certain bugs when there is FTDC but no core dump. An example is the error seen in WT-9130 where an insert failed but with no obvious cause.
A discussion is needed to validate the usefulness of this feature, and the implementation isn't clear yet but I suspect we could add a hook into API_END_RET, it may also have a small performance impact as it would add N comparisons to the exit of the API depending on how many statistics we chose to create. Possibly we should only compile with HAVE_DIAGNOSTIC.
- Testing
Perf testing, functional python testing.