Don’t suppose you used ‘INSERT IGNORE’ and the inserts contained duplicate keys?

From: Nick<>
Sent: 06 February 2018 11:52
Subject: [sqlite] Question about threadsafe

I use sqlite 3.16.2 in Android system and I have configured journal_mode=WAL,

My understanding is that:
        WAL => readers and only one writer can run at the same time.
        threadsafe=1 => mutex is used in serialized mode so that two writers is
Is it correct?

But I ran a simple test:
Two processes will run sqlite3_open() respectively to open the same db. Then
both of the two processes will insert 10000 records(in Transaction) into the
db simultaneously.
But I find that:

Process A begin
Process A insert
            Process B begin
            Process B insert
Process A end
            Process B end

Which I guess the Process B did not sleep at all?
And the count of records is less than 20000 at last.

So I think multiple write threads is not allowed even though I use
threadsafe=1 in wal mode?

Sent from:
sqlite-users mailing list

sqlite-users mailing list

Reply via email to