sqlite: do not `Ping()` after connecting
`Ping()` requires the DB lock, so we had to move it into a transaction to fix #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: #17859 Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
		
							parent
							
								
									2cfb6e1c0e
								
							
						
					
					
						commit
						cdb5b3e990
					
				| 
						 | 
					@ -80,10 +80,6 @@ func NewSqliteState(runtime *Runtime) (_ State, defErr error) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	state.conn = conn
 | 
						state.conn = conn
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if err := state.conn.Ping(); err != nil {
 | 
					 | 
				
			||||||
		return nil, fmt.Errorf("cannot connect to database: %w", err)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// Migrate schema (if necessary)
 | 
						// Migrate schema (if necessary)
 | 
				
			||||||
	if err := state.migrateSchemaIfNecessary(); err != nil {
 | 
						if err := state.migrateSchemaIfNecessary(); err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue