Skip to content

Commit

Permalink
add required ping before creating database object
Browse files Browse the repository at this point in the history
  • Loading branch information
eze-kiel committed Feb 26, 2021
1 parent 7e80e87 commit 42ac8db
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cmd/slowql-replayer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ func (o options) createDB() (*database, error) {
switch strings.ToLower(o.kind) {
case "mysql":
db.kind = slowql.MySQL
case "pxc":
db.kind = slowql.PCX
case "mariadb":
db.kind = slowql.MariaDB
case "pxc":
db.kind = slowql.PCX
default:
return nil, errors.New("unknown kind " + o.kind)
}
Expand All @@ -143,6 +143,11 @@ func (o options) createDB() (*database, error) {
return nil, err
}
db.dryRun = o.dryRun

if err = db.drv.Ping(); err != nil {
return nil, err
}

return &db, nil
}

Expand Down

0 comments on commit 42ac8db

Please sign in to comment.