SQLite multi process access

后端 未结 3 1337
南笙
南笙 2021-02-09 04:32

We are using SQLite in a multi processes and multi threaded application. The SQLite database files are encrypted using the embedded SQLite encryption. The FAQ states that SQLite

3条回答
  •  耶瑟儿~
    2021-02-09 05:12

    Thanks for all your comments!

    (it is to mention we are using the System.Data.SQLite .Net library)

    In the meanwhile we made some more tests and here are the outcomes

    ===============

    We've built a tester that does the following: - create a table with a number of fields. One of the fields - nvarchar(255) - has a unique index: "create unique index IX_MyKey on Table (MyKey)" - start many idenctical processes (25) simultaneously - Each process has a Key (string representing a number 1-25) - Each process has a single (main) thread doing the following in a loop for 30 sec:

    read the record where MyKey=@MyKey (the Key of the process) get a value of a numeric field write back 'value + 1' to the same field of the same record "insert or replace ... where MyKey=@MyKey"

    ===============

    • When we do all above using the System.Data.SQLite library without encryption - everything works as expected (including locks that are slowing down the access to the database when the amount of processes increases)

    • When we use encryption (by setting a password to the database), the index unique constrain is "broken" - there appear records having the same MyKey value

    ===============

    So it seams the problem is somehow related to encryption...

提交回复
热议问题