Skip to content

Commit

Permalink
changefeedccl: deflake TestChangefeedRetryableSinkError
Browse files Browse the repository at this point in the history
TestChangefeedRetryableSinkError was performing many rounds of bcrypt,
which is excruciatingly slow when the race detector is on. Put its test
cluster into insecure mode to skip bcrypt hashing.

Fix cockroachdb#30156.
Fix cockroachdb#30161.

Release note: None
  • Loading branch information
benesch committed Sep 13, 2018
1 parent 544c6e4 commit 3d64d9f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/ccl/changefeedccl/changefeed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,11 @@ func TestChangefeedRetryableSinkError(t *testing.T) {
return nil
}
s, sqlDBRaw, _ := serverutils.StartServer(t, base.TestServerArgs{
// This test causes a lot of pgwire connection attempts which, in secure
// mode, results in many rounds of bcrypt hashing. This is excruciatingly
// slow with the race detector on. Just use insecure mode, which avoids
// bcrypt.
Insecure: true,
Knobs: base.TestingKnobs{
DistSQL: &distsqlrun.TestingKnobs{
Changefeed: &TestingKnobs{
Expand All @@ -785,11 +790,11 @@ func TestChangefeedRetryableSinkError(t *testing.T) {
// Create original data table.
sqlDB.Exec(t, `CREATE DATABASE d`)
sqlDB.Exec(t, `CREATE TABLE foo (a INT PRIMARY KEY, b STRING)`)
sqlDB.Exec(t, `CREATE USER sinkuser WITH PASSWORD sink`)
sqlDB.Exec(t, `CREATE USER sinkuser`)
sqlDB.Exec(t, `GRANT ALL ON DATABASE d TO sinkuser`)

// Create changefeed into SQL Sink.
row := sqlDB.QueryRow(t, fmt.Sprintf(`CREATE CHANGEFEED FOR foo INTO 'experimental-sql://sinkuser:sink@%s/d'`, s.ServingAddr()))
row := sqlDB.QueryRow(t, fmt.Sprintf(`CREATE CHANGEFEED FOR foo INTO 'experimental-sql://sinkuser@%s/d?sslmode=disable'`, s.ServingAddr()))
var jobID string
row.Scan(&jobID)

Expand Down
5 changes: 5 additions & 0 deletions pkg/ccl/changefeedccl/sink.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ func getSink(sinkURI string, targets jobspb.ChangefeedTargets) (Sink, error) {
if err != nil {
return nil, err
}
// Mark all query parameters as consumed; since the connection succeeded,
// we assume they were valid SQL connection parameters.
for k := range q {
q.Del(k)
}
default:
return nil, errors.Errorf(`unsupported sink: %s`, u.Scheme)
}
Expand Down

0 comments on commit 3d64d9f

Please sign in to comment.