[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: LMDB Hanging Problem in Multi-Threaded Application
On 09/06/16 02:46, Eskandar Ensafi wrote:
So is the correct usage to have a single thread create the transaction, and the same thread that created it waits for some kind of event to occur indicating the data has arrived, and then it adds data to the database and waits for the next event?
Swap the order to avoid long-lived transactions, like Caveats in
lmdb.h says. I.e. wait for some work to do, start a transaction,
write whatever to the database, commit.
Basically, it seems that only one thread can be in charge of putting and committing.
Well, only one thread *at a time* since there only can be one
write-transaction at a time. If a write-transaction exists,
mdb_txn_begin(new write-transaction) in another thread/process
will wait for the existing write-transaction to commit/abort.