Skip to content

Commit 7a97af5

Browse files
committed
sql: remove slow functions from TestRandomSyntaxFunctions
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: cockroachdb#107929 Release note: None
1 parent 4fe2a80 commit 7a97af5

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

pkg/sql/tests/rsg_test.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,16 @@ func (db *verifyFormatDB) execWithResettableTimeout(
200200
return &nonCrasher{sql: sql, err: err}
201201
}
202202
return nil
203+
case <-ctx.Done():
204+
// Sanity: The context is cancelled when the test is about to
205+
// timeout. We will log whatever statement we're waiting on for
206+
// debugging purposes. Sometimes queries won't respect
207+
// cancellation due to lib/pq limitations.
208+
t.Logf("Context cancelled while executing: %q", sql)
209+
// We will intentionally retry, which will us to wait for the
210+
// go routine to complete above to avoid leaking it.
211+
retry = true
212+
return nil
203213
case <-time.After(targetDuration):
204214
db.mu.Lock()
205215
defer db.mu.Unlock()
@@ -357,7 +367,9 @@ func TestRandomSyntaxFunctions(t *testing.T) {
357367
case "crdb_internal.reset_sql_stats",
358368
"crdb_internal.check_consistency",
359369
"crdb_internal.request_statement_bundle",
360-
"crdb_internal.reset_activity_tables":
370+
"crdb_internal.reset_activity_tables",
371+
"crdb_internal.revalidate_unique_constraints_in_all_tables",
372+
"crdb_internal.validate_ttl_scheduled_jobs":
361373
// Skipped due to long execution time.
362374
continue
363375
}

0 commit comments

Comments
 (0)