[Date Prev][Date Next]
Re: LMDB: question about MDB_RESERVE
- To: Christian Sell <firstname.lastname@example.org>, "OpenLDAP, Technical" <email@example.com>
- Subject: Re: LMDB: question about MDB_RESERVE
- From: Bryan Matsuo <firstname.lastname@example.org>
- Date: Mon, 21 Dec 2015 01:25:32 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :content-type; bh=43YmA/2l0UfSoRT8wjStpqBvJXnM1dXJwtborg4Rxaw=; b=TySy4yyI9/f8ln8EQOFwBIMikLG5/2Lv7hkVIPzANihHAHbppssSx1Us432B+jrR/Y 4q+NMhqjudP9exS71Imj/LjY9O6nHEt8r1gSR9EPIWTzjz1tG+uJ2yPRdwvkse58ssNa azklgnSRbetpAjl3Io5KcS93pA8LtPMWNt2XeV5xspbbNJ3bpeqsMse4zz+SmJvqB6QJ 45CW7j0EObGQtR+o6x6qpJJD/TlDuh60rLmQU/XfeH9IFzxC7mxcq2kwUJ3LVL2izKm7 1VF1OIMqQx8xD3CoaQBqPr4Qjr3LtE9tkeFjrHhrHpPHuG9pAQYt6nMYnoqSJi5taHJO 7CGQ==
- In-reply-to: <1878599979.1012421.1450649629106.JavaMail.email@example.com>
- References: <1878599979.1012421.1450649629106.JavaMail.firstname.lastname@example.org>
I believe the documentation is making a more general statement. Yes, a subsequent "put" invalidates the MDB_RESERVE pointer. But, beyond "put", "del" operations will invalidate the destination pointer. In general, it's probably safest to assume that an "update operation" is any operation that must take place inside an update transaction (one that is not readonly).
My point of view on the library is that failing to obey its documented operational requirements means all bets are off. Assume database corruption will occur. And be happy if that isn't actually the case. Because the effect is undocumented it may change between releases and you cannot rely on it. You don't want to get stuck on an old library version because of reliance on undefined behavior. Undefined behavior may not even be portable between operating systems because of platform specific function implementations.
I hope this helps. I think the documentation is probably accurate enough. Like the other docs, it is terse and merely requires a careful, literal reading. If "get" operations were to invalidate the MDB_RESERVE pointer than I think the docs would need to be changed. But my intuition makes me doubt that is the case.
I have a question about the MDB_RESERVE flag. The documentation in some places
says "reserve space for data of the given size, but don't copy the given data.
Instead, return a pointer to the reserved space, which the caller can fill in
later - before the next update operation or the transaction ends."
My question is specifically about the "before the next update operation or the
transaction ends" part. Does this mean the reserved buffer becomes unusable as
soon as another put is executed? What exactly happens? This statement does not
appear consistently, which is why I am doubting..
thanks + happy holidays,