pkg/sql/sqlstats: de-flake TestTransactionInsightsFailOnCommit #121294
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.
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 theFailedExecution
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