(HACKATHON) sql: inject retry errors with test session var#45224
Open
knz wants to merge 1 commit intocockroachdb:masterfrom
Open
(HACKATHON) sql: inject retry errors with test session var#45224knz wants to merge 1 commit intocockroachdb:masterfrom
knz wants to merge 1 commit intocockroachdb:masterfrom
Conversation
Member
2ec131e to
1dec239
Compare
Previously, retry errors were only produced under contention. This not good for training developers; because in developer environments there is often no natural contention. It's thus possible for a dev to move very far forward with their app without realizing they need to care about retry errors. This patch makes it possible for devs to validate that they have all the necessary retry loops. Client side retry errors are forced; after 3 valid retry iterations (with the `cockroach_restart` savepoint rollback) the transaction is allowed to succeed. This mechanism is only enabled when the (new) session var `retry_errors_enabled` is set to true—and it defaults to false. At this point this feature is restricted to explicit transactions. Release note: None
1dec239 to
6864aaf
Compare
dt
reviewed
Feb 20, 2020
Contributor
dt
left a comment
There was a problem hiding this comment.
This is super cool! I just had two nits about naming/messaging.
|
|
||
| // CockroachDB extension. | ||
| `retry_errors_enabled`: { | ||
| GetStringVal: makeBoolGetStringValFn(`retry_errors_enabled`), |
Contributor
There was a problem hiding this comment.
bikeshed/nitpick: 2¢ i'd give this a name like inject_retry_errors that makes it clearer that this controls synthetic/injected errors (i.e. as is, i think you could read this setting as automatically retrying on errors).
| if ex.sessionData.RetryErrorsEnabled && stmt.AST.StatementTag() != "SET" { | ||
| if planner.Txn().Epoch() < ex.state.lastEpoch+3 { | ||
| retryErr := planner.Txn().GenerateForcedRetryableError( | ||
| ctx, "forced by executor") |
Contributor
There was a problem hiding this comment.
nit: I'd say "injected" by executor since it you might not be sure why it was "forced by executor". In. fact, i'd include the name of the flag in the error too, e.g. "error injected by executor due to <setting_name>".
Contributor
Author
|
Thanks David these are good suggestions. I'll work them in when I get to my terminal again.
--
Verstuurd vanaf mijn Android apparaat met K-9 Mail. Excuseer mijn beknoptheid.
|
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.
Written with @johnrk
Previously, retry errors were only produced under contention.
This not good for training developers; because in developer
environments there is often no natural contention. It's thus possible
for a dev to move very far forward with their app without realizing
they need to care about retry errors.
This patch makes it possible for devs to validate that they have all
the necessary retry loops. Client side retry errors are forced; after
3 valid retry iterations (with the
cockroach_restartsavepointrollback) the transaction is allowed to succeed. This mechanism is
only enabled when the (new) session var
retry_errors_enabledis setto true—and it defaults to false.
At this point this feature is restricted to explicit transactions.
Release note: None