[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: reusing transactions in LMDB



Hi.

Sorry for being so dense but...

The document says

The transaction handle is freed. It and its cursors must not be used again after this call, except with mdb_cursor_renew().


I am still very confused about reusing transactions.

If I commit or abort a read write transaction I can't reuse the transaction but I can re use the cursor? In the cursor documentation it says

 Cursors that are only used in read-only transactions may be re-used, to avoid unnecessary malloc/free overhead.

So this indicates only read only cursors can be reused right?

So can you confirm my understanding? This is what I get from reading the docs.

A transaction can either be read write or read only. 

If a transaction is read only you can commit or abort the transaction and then re-open it again for further use. 

If a transaction is read write then it can't be used again after you commit or abort the transaction.





On Tue, Nov 22, 2016 at 3:17 PM, Howard Chu <hyc@symas.com> wrote:
Tim Uckun wrote:


    No. You can perform multiple write operations in a single transaction.


But once the commit has been called the next write operation has to be a newly
opened transaction right?  The write transactions can't be re-opened.

http://lmdb.tech/doc/group__mdb.html#ga846fbd6f46105617ac9f4d76476f6597


--
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/