Skip to content

Commit

Permalink
sqlite: do not Ping() after connecting
Browse files Browse the repository at this point in the history
`Ping()` requires the DB lock, so we had to move it into a transaction
to fix containers#17859. Since we try to access the DB directly afterwards, I
prefer to let that fail instead of paying the cost of a transaction
which would lock the DB for _all_ processes.

[NO NEW TESTS NEEDED] as it's a hard to reproduce race.

Fixes: containers#17859
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
  • Loading branch information
vrothberg authored and edsantiago committed Mar 28, 2023
1 parent 0a31382 commit fb168fd
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions libpod/sqlite_state.go
Expand Up @@ -80,10 +80,6 @@ func NewSqliteState(runtime *Runtime) (_ State, defErr error) {

state.conn = conn

if err := state.conn.Ping(); err != nil {
return nil, fmt.Errorf("cannot connect to database: %w", err)
}

// Migrate schema (if necessary)
if err := state.migrateSchemaIfNecessary(); err != nil {
return nil, err
Expand Down

0 comments on commit fb168fd

Please sign in to comment.