Skip to content

Commit

Permalink
sql: remove slow functions from TestRandomSyntaxFunctions
Browse files Browse the repository at this point in the history
Previously, we could easily timeout running slower,
functions in the random syntax functions test. We
attempted to minimize this risk with resettable timeouts
which helped, but libpq has limited support for cancellation,
so we need to fully pull these out. To address this,
this patch will remove:
crdb_internal.revalidate_unique_constraints_in_all_tables
and crdb_internal.validate_ttl_scheduled_jobs from testing.

Fixes: #107929
Release note: None
  • Loading branch information
fqazi committed Aug 3, 2023
1 parent 4fe2a80 commit 7a97af5
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion pkg/sql/tests/rsg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,16 @@ func (db *verifyFormatDB) execWithResettableTimeout(
return &nonCrasher{sql: sql, err: err}
}
return nil
case <-ctx.Done():
// Sanity: The context is cancelled when the test is about to
// timeout. We will log whatever statement we're waiting on for
// debugging purposes. Sometimes queries won't respect
// cancellation due to lib/pq limitations.
t.Logf("Context cancelled while executing: %q", sql)
// We will intentionally retry, which will us to wait for the
// go routine to complete above to avoid leaking it.
retry = true
return nil
case <-time.After(targetDuration):
db.mu.Lock()
defer db.mu.Unlock()
Expand Down Expand Up @@ -357,7 +367,9 @@ func TestRandomSyntaxFunctions(t *testing.T) {
case "crdb_internal.reset_sql_stats",
"crdb_internal.check_consistency",
"crdb_internal.request_statement_bundle",
"crdb_internal.reset_activity_tables":
"crdb_internal.reset_activity_tables",
"crdb_internal.revalidate_unique_constraints_in_all_tables",
"crdb_internal.validate_ttl_scheduled_jobs":
// Skipped due to long execution time.
continue
}
Expand Down

0 comments on commit 7a97af5

Please sign in to comment.