Reputation: 2574
Reading the SQLite documentation here, when a process wants to write to a SQLite database it obtains a reserved lock. Then once the process is ready to write to disk it obtains a pending lock, during which no new processes can obtain a shared lock, but existing shared locks are allowed to finish their business. Once the remaining shared locks clear, the process can write.
However...when I try to write a database while other processes are reading from that database, I just get an immediate "Error: dataset is locked".
sqlite> insert into meta_models (model) values ("hello_world");
Error: database is locked
Why doesn't SQLite it go through the steps I outlined above of waiting for the shared locks to clear?
Upvotes: 0
Views: 165
Reputation: 180060
SQLite does go through these steps, but it timed out while waiting for the remaining shared locks to clear.
You can adjust this timeout with PRAGMA busy_timeout.
Upvotes: 2