[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openldap-technical
Subject:    Re: LMDB Hanging Problem in Multi-Threaded Application
From:       Hallvard Breien Furuseth <h.b.furuseth () usit ! uio ! no>
Date:       2016-06-09 22:30:18
Message-ID: 6ba6cd1f-a87f-5fe0-3bca-087e1f0befb0 () usit ! uio ! no
[Download RAW message or body]


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.



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic