This article is written

Initially, SQlite worked on the principle of "many read - one writes." That is, only one connection writes to the database at a given time. If other connections try to write too, they get the error SQLITE_BUSY. ... not so long ago a new kind of SQlite log appeared: Write Ahead Log, WAL. If you enable this particular log mode for the database, then several connections will be able to simultaneously modify the database.

I can not understand how to use it. I create a test database in which journal_mode = WAL and get 3 files, that is, the mode is activated.

but the simplest test code

string conString = @"Data Source=test.db;Version=3;Foreign Keys=true;Connect Timeout=30"; var conn1=new SQLiteConnection(conString); var conn2=new SQLiteConnection(conString); conn1.Open(); conn1.BeginTransaction(); conn2.Open(); conn2.BeginTransaction(); 

shows that it hangs on conn2.BeginTransaction (); and then crashes that the database is locked "database is locked"

How to use WAL correctly?

    0