[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: reusing transactions in LMDB
- To: Tim Uckun <timuckun@gmail.com>
- Subject: Re: reusing transactions in LMDB
- From: Howard Chu <hyc@symas.com>
- Date: Tue, 22 Nov 2016 02:37:31 +0000
- Cc: openldap-technical@openldap.org
- In-reply-to: <WM!a2d37173f8c5f8427b126d0340dcc9e59bb5888332a1b0ce8c7d7083e2d87057b901bd39c7169e3677edba7207088862!@mailstronghold-2.zmailcloud.com>
- References: <CAGuHJrOL-U0-YqNYUXGCSCUbU=rsAEv=yP=WdFWKh-znLtZ_yg@mail.gmail.com> <WM!fdad9a2840d0d021c5b6ed91e52c7ac3b4ef655672f6d9a8d8a83e73b9df001a95edda9b0895fd52e873f808c3ac550b!@mailstronghold-1.zmailcloud.com> <d102d080-bfdd-f843-1ab0-7277259e98be@symas.com> <CAGuHJrONkBhDn3geidwYZ=dHM1cUYYK+23K68Ai9V1cpZHRVCQ@mail.gmail.com> <WM!f8f7dfdce69d0a8cf84616efeacdf48fee8e34ee4671a441aed1610b9bde09ba8ea33902adfa7d82f904b98f01f319d8!@mailstronghold-2.zmailcloud.com> <0992429d-7266-9719-3239-978f8ac9a4e1@symas.com> <CAGuHJrPQW_T432KWpuLZS6O33Y9sZvohMDm5j3V_f+Xk12-ipQ@mail.gmail.com> <WM!a2d37173f8c5f8427b126d0340dcc9e59bb5888332a1b0ce8c7d7083e2d87057b901bd39c7169e3677edba7207088862!@mailstronghold-2.zmailcloud.com>
- User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0 SeaMonkey/2.46a2
Tim Uckun wrote:
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.
Keep reading.
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?
Yes.
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.
No. Once a transaction is committed or aborted it is freed and cannot be
reused. Period, end of story. Both the commit() and abort() docs are quite
explicit about this.
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
<mailto: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
<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/