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

pkg/sql/sqlstats: de-flake TestTransactionInsightsFailOnCommit #121294

Merged

Conversation

abarganier
Copy link
Contributor

Fixes: #117061

Epic: none

TestTransactionInsightsFailOnCommit runs two transactions, one of which is expected to fail on commit due to an isolation error as it interacts with the other transaction.

We query crdb_internal.node_txn_execution_insights, which queries the in-memory insights data, to check that a txn insight was generated for the failed txn with a FailedExecution insight.

However, when querying the crdb_internal table, the query is too broad. In the test, the successful transaction can still possibly generate a SlowExecution insight. In this case, when looking for the FailedExecution insight, we were instead getting an insight from the successful transaction.

The fix is to narrow the SELECT criteria to ensure we're selecting the correct insight.

The fix also expands the failed assertion logging.

Release note: none

Fixes: cockroachdb#117061

TestTransactionInsightsFailOnCommit runs two transactions, one
of which is expected to fail on commit due to an isolation error
as it interacts with the other transaction.

We query crdb_internal.node_txn_execution_insights, which queries
the in-memory insights data, to check that a txn insight was generated
for the failed txn with a `FailedExecution` insight.

However, when querying the crdb_internal table, the query is too broad.
In the test, the successful transaction can still possibly generate a
`SlowExecution` insight. In this case, when looking for the
`FailedExecution` insight, we were instead getting an insight from the
successful transaction.

The fix is to narrow the SELECT criteria to ensure we're selecting the
correct insight.

The fix also expands the failed assertion logging.

Release note: none
@abarganier abarganier marked this pull request as ready for review March 28, 2024 18:37
@abarganier abarganier requested a review from a team March 28, 2024 18:37
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@dhartunian dhartunian left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @xinhaoz)

@abarganier
Copy link
Contributor Author

TFTR!

bors r=dhartunian

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.

pkg/sql/sqlstats/insights/integration/integration_test: TestTransactionInsightsFailOnCommit failed
3 participants