Skip to content

Commit

Permalink
conn retry
Browse files Browse the repository at this point in the history
  • Loading branch information
msbutler committed Jan 31, 2023
1 parent bc97bac commit c582697
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions pkg/cmd/roachtest/tests/multitenant_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,20 @@ func createInMemoryTenant(
sysSQL.Exec(t, "CREATE TENANT $1", tenantName)
sysSQL.Exec(t, "ALTER TENANT $1 START SERVICE SHARED", tenantName)

// Ensure the tenant server is ready to accept queries.
tenantConn := c.Conn(ctx, t.L(), nodes.RandNode()[0], option.TenantName(tenantName))
tenantSQL := sqlutils.MakeSQLRunner(tenantConn)
// Opening a SQL session to a newly created in-process tenant may require a
// few retires. Unfortunately, the c.ConnE and MakeSQLRunner APIs do not make
// it clear if they eagerly open a session with the tenant or wait until the
// first query. Therefore, wrap connection opening _and_ a select query in
// separate retry loops.
var tenantSQL *sqlutils.SQLRunner
testutils.SucceedsSoon(t, func() error {
tenantConn, err := c.ConnE(ctx, t.L(), nodes.RandNode()[0])
if err != nil {
return err
}
sysSQL = sqlutils.MakeSQLRunner(tenantConn)
return nil
})
tenantSQL.ExecSucceedsSoon(t, `SELECT 1`)

// Currently, a tenant has by default a 10m RU burst limit, which can be
Expand Down

0 comments on commit c582697

Please sign in to comment.