[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: Resizing of LMDB map
Daniel Kraft wrote:
> On 2018-11-13 09:59, hyc@highlandsun.com wrote:
>> On Tue, Nov 13, 2018 at 07:09:08AM +0000, Daniel Kraft wrote:
>>> On 2018-11-12 21:21, Howard Chu wrote:
>>> Ah ok, so mdb_txn_commit also frees the transaction if it then actually
>>> fails with MDB_MAP_FULL -- I was missing that. By avoiding the
>>> mdb_txn_abort in that case, my example code indeed works now!
>>>
>>> So is it correct to assume that the transaction is "effectively aborted"
>>> after mdb_txn_commit fails with MDB_MAP_FULL (or, for that matter, any
>>> error)?
>>
>> http://www.lmdb.tech/doc/group__mdb.html#ga846fbd6f46105617ac9f4d76476f6597
>>
>> The doc is quite clear. After you call commit the txn is freed.
>
> Yes, that part is clear (I just missed it before).
>
> But the doc doesn't say anything about what happens to the transaction
> data in case of an error. I think it is quite reasonable to assume that
> the transaction is fully aborted (as if mdb_txn_abort was called instead
> of mdb_txn_commit) in case of an error (since otherwise transaction
> atomicity would be violated), but I just wanted to check this is indeed
> what happens.
Imagine if the txn were not aborted in case of error. The txn structure is
gone, already freed, so what are you going to do to clean it up?
There is only one sensible outcome.
--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/