- Notifications
You must be signed in to change notification settings - Fork124
Closed
Description
My assumption was that theDbi
object would be created once and then can be used from any thread (using relevant read/write transactions). I based this on the docshere:
Generally databases should only be opened once, by the first transaction in the process. After the first transaction completes, the database handles can freely be used by all subsequent transactions
If this is the case then there is a bug due tocompKeyA
andcompKeyB
being fields inDbi
and thus shared across users ofDbi
.This code shows how a reader will lead to corrupt inserts of sequential keys whenDbi
is shared. It feels like the reusable buffers should be coupled with thetxn
object, but I cannot see a good way of achieving this in the current form.