cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
30.13k stars 3.81k forks source link

sql: inject_retry_errors_enabled indefinitely adds errors if transaction has multiple statements #98572

Open Randgalt opened 1 year ago

Randgalt commented 1 year ago

Describe the problem

I've found what appears to be a bug with inject_retry_errors_enabled session variable. I've created a test that shows the problem. If I add a SELECT statement to the transaction that has inject_retry_errors_enabled then the error is injected infinitely instead of the documented 3 times.

To Reproduce

https://gist.github.com/Randgalt/4cb3448d542c5b8257dec4b2949ef8a8

Jira issue: CRDB-25341

blathers-crl[bot] commented 1 year ago

Hello, I am Blathers. I am here to help you get the issue triaged.

Hoot - a bug! Though bugs are the bane of my existence, rest assured the wretched thing will get the best of care here.

I was unable to automatically find someone to ping.

If we have not gotten back to your issue within a few business days, you can try the following:

:owl: Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

rafiss commented 1 year ago

Thanks for this report. The inject_retry_errors_enabled setting has a limitation: The behavior of only injecting an error 3 times if you are using savepoints only applies if the transaction you are using has a single statement.

Randgalt commented 1 year ago

Ok. I don’t recall that in the docs. At minimum the docs should make this clear. Any chance of supporting multi-statement transactions for this?