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

From: Nick<mailto:haveagoodtime2...@gmail.com>
Sent: 06 February 2018 11:52
To: 
sqlite-users@mailinglists.sqlite.org<mailto:sqlite-users@mailinglists.sqlite.org>
Subject: [sqlite] Question about threadsafe

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

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
supported.
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: http://sqlite.1065341.n5.nabble.com/
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to