diff --git a/pkg/sql/sqlstats/persistedsqlstats/datadriven_test.go b/pkg/sql/sqlstats/persistedsqlstats/datadriven_test.go index e5c1fff0b386..9d4600c977f2 100644 --- a/pkg/sql/sqlstats/persistedsqlstats/datadriven_test.go +++ b/pkg/sql/sqlstats/persistedsqlstats/datadriven_test.go @@ -25,6 +25,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/sqlstats" "github.com/cockroachdb/cockroach/pkg/sql/sqlstats/persistedsqlstats" "github.com/cockroachdb/cockroach/pkg/sql/tests" + "github.com/cockroachdb/cockroach/pkg/testutils" "github.com/cockroachdb/cockroach/pkg/testutils/datapathutils" "github.com/cockroachdb/cockroach/pkg/testutils/serverutils" "github.com/cockroachdb/cockroach/pkg/testutils/skip" @@ -33,6 +34,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/util/log" "github.com/cockroachdb/cockroach/pkg/util/syncutil" "github.com/cockroachdb/datadriven" + "github.com/cockroachdb/errors" ) const ( @@ -104,10 +106,13 @@ func TestSQLStatsDataDriven(t *testing.T) { case "exec-sql": stmts := strings.Split(d.Input, "\n") for i := range stmts { - _, err := sqlConn.Exec(stmts[i]) - if err != nil { - t.Errorf("failed to execute stmt %s due to %s", stmts[i], err.Error()) - } + testutils.SucceedsSoon(t, func() error { + _, exSqlErr := sqlConn.Exec(stmts[i]) + if exSqlErr != nil { + return errors.NewAssertionErrorWithWrappedErrf(exSqlErr, "failed to execute stmt %s", stmts[i]) + } + return nil + }) } case "observe-sql": actual := observer.QueryStr(t, d.Input) diff --git a/pkg/sql/sqlstats/persistedsqlstats/testdata/logical_plan_sampling_for_explicit_txn b/pkg/sql/sqlstats/persistedsqlstats/testdata/logical_plan_sampling_for_explicit_txn index 1e5a4cfb587f..0838c5d9f7f6 100644 --- a/pkg/sql/sqlstats/persistedsqlstats/testdata/logical_plan_sampling_for_explicit_txn +++ b/pkg/sql/sqlstats/persistedsqlstats/testdata/logical_plan_sampling_for_explicit_txn @@ -1,12 +1,8 @@ -skip issue-num=89861 ----- - # This test checks the expected behavior of logical plan sampling. # Given a tuple of (db_name, implicitTxn, fingerprint string), the logical plan # is only sampled if and only if no logical plan has been sampled for the given # tuple in the last 5 minutes. (This is controlled via # sql.metrics.statement_details.plan_collection.period cluster setting). - exec-sql SET application_name = 'app1' ----