Closed
Conversation
43bf62f to
1c0ec25
Compare
Introduce probabilistic injection errors and SMGR API injection hook. * Add a global counter `inside_smgr_api` (under `USE_INJECTION_POINTS`) in `postgres.c` and declare it in `postgres.h` so Neon’s injection framework can detect when execution is inside the SMGR API. * In `ProcessInterrupts`, when injection points are enabled and `inside_smgr_api > 0`, trigger the `"SMGR_API"` injection point, allowing tests to simulate faults specifically while in SMGR-related code paths. * Extend `InjectionPointCondition` with a `double prob` field representing a probability in [0, 1], and add `injection_error_prob` which behaves like `injection_error` but only raises an error according to this probability. * Implement `injection_error_prob` to first check `injection_point_allowed`, then draw a random value using `rand()` and return early unless the draw is within the configured probability; otherwise it raises an error with `elog(ERROR, ...)`. * Add `action2prob(const char *action, int pos)` to parse probability values encoded in the action name (e.g., `error-prob-0-01` → 0.01) by converting `-` to `.` and calling `strtod`, validating the result is in [0.0, 1.0], and erroring out on invalid values. * Extend `injection_points_attach` to recognize actions starting with `error-prob-`, parse the probability into `condition.prob` via `action2prob`, and attach an injection point using `injection_error_prob` as the callback.
65be8b9 to
a7c7f1f
Compare
sdebnath
reviewed
Feb 13, 2026
|
|
||
| extern PGDLLEXPORT void injection_error(const char *name, | ||
| const void *private_data); | ||
| extern PGDLLEXPORT void injection_error_prob(const char *name, |
There was a problem hiding this comment.
We should just call this `injection_error_probability" so its clear its not "prob"lem. Do we have tests that utilize this or is it for manual testing. Good function to have though.
Author
There was a problem hiding this comment.
Sorry it was not my commit.
It is from PR #878
Have no idea why it was included in this PR (looks like it is because of merge with vanilla).
Should I create new PR without this changes?
Or should we merge them?
Author
|
Replaced with #892 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Define
get_pin_limit_hookto prevent too small prefetch distance in case of largemax_connections.