https://kotlinlang.org logo
#exposed
Title
# exposed
t

Tim McCormack

06/20/2021, 10:54 PM
If I connect to a SQLite DB in Exposed and use the same
Database
instance in separate transactions in two separate threads... I would expect to see uncommitted reads and similar. But I can't seem to reproduce that with a test. Does Exposed do something to ensure isolation?
I'm under the impression that Exposed only creates one connection here, and that SQLite (in its default configuration) allows concurrent transactions on the same connection to see changes made by each other.
However, I wrote this test to try to read from one thread after another thread wrote, but before the transaction closed (using latches) and it passes but I don't understand why. :-)
t

tapac

06/25/2021, 9:30 AM
I'm not an expert of SQLite but afaik the multithreaded code normally works only with a single connection (https://www.sqlite.org/threadsafe.html).
t

Tim McCormack

06/27/2021, 6:47 PM
I believe that when that page talks about "safety" it's referring to classic thread-safety (preventing memory corruption, etc.) rather than transactional isolation.
7 Views