Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: ensure auto-retrying transactions respect the statement_timeout #54370

Merged

Conversation

arulajmani
Copy link
Collaborator

Backport:

Please see individual PRs for details.

/cc @cockroachdb/release

@cockroach-teamcity
Copy link
Member

This change is Reviewable

defer tc.Stopper().Stop(ctx)

conn, err := tc.ServerConn(0).Conn(ctx)
require.NoError(t, err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like the require import was added in 39e7448

i think you can just add the import here

@arulajmani arulajmani added the do-not-merge bors won't merge a PR with this label. label Sep 15, 2020
@arulajmani
Copy link
Collaborator Author

arulajmani commented Sep 15, 2020

I might need to get #54415 in as well to deflake CI, so I'm putting the DNM label on this for now.

Previously, if a statement exceeded the statement_timnout in the
conn_executor, but failed with a retryable error, we would still retry
it. This was because even though we overrode the error, we didn't
override the `fms.Event` and `fsm.EventPayload` which actually dictates
the next transition. This patch overrides them, thereby ensuring that
even if a timed out query/cancelled query encountered a retryable
error, we do not transition into retrying it.

Fixes cockroachdb#52845

Release justification: low risk, high benefit changes to existing functionality

Release note (bug fix): queries that can be automatically retried did
not respect the `statement_timeout` earlier, which is now fixed.
Previously the statement timeout in a logic test was set to 1ms, which
was sometimes not enough to complete resetting the statement timeout
after the test, causing it to flake. This PR increases the timeout
from 1ms to 10ms so that we don't flake on the cleanup.

Release note: None
Previously, if a user set a really low statement_timeout value, there
would be no way to reset it/remove the statement_timeout entirely. To
get around this, all `SET` statements are now exempt from the statement
timeout.This should also fix some of the flakes we were seeing in
checks were decoupled in cockroachdb#53968. `SET` statements aren't canceled as no
one checks for a canceled context, which meant this exemption existed
implicitly before cockroachdb#53968.

Closes cockroachdb#54372

Release note: None
@arulajmani arulajmani removed the do-not-merge bors won't merge a PR with this label. label Sep 16, 2020
@arulajmani
Copy link
Collaborator Author

This should be ready now that #54415 is in.

@arulajmani arulajmani merged commit 48e1123 into cockroachdb:release-20.2 Sep 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants