[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: lmdb: is read operation permitted inside the write transaction?
- To: Hallvard Breien Furuseth <h.b.furuseth@usit.uio.no>
- Subject: Re: lmdb: is read operation permitted inside the write transaction?
- From: Timur Kristóf <timur.kristof@gmail.com>
- Date: Tue, 19 May 2015 17:39:44 +0200
- Cc: Howard Chu <hyc@symas.com>, Dmytro Milinevskyy <dmytro@forgetbox.com>, openldap-devel@openldap.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:cc:date:in-reply-to:references :content-type:mime-version:content-transfer-encoding; bh=4E6ZUvj/LvEtFAQhzPwGKjQXAtJH18ux+yRucnxWZ5s=; b=Ymy5C/uQCMUUeRtbkJg6h2xcHcF9RZWClCiB5U9sor3eN/JeaQREqWfOkWJTFWtklJ dhMPS/Tj+iRPsf59brrTdFr/vhH0wM8+osfwi5MQQjX+0t32qDjPskmWJFXPalITdbw0 G4A+qHUrsL6O5O3SoPiwtnM8Df0McJH7aMsgfDzxQV41VX2XnZRcTVtDhhaTT9yzrzYR gHqc1YTyjYKSb/1GMDjW4N9UbnMEMUrmZJ3FnIJc0yWu1R5G56U5tdbx+vw+qMR47Z0r PEV5l1PBohYAwaotLUP+4jU9VFHFebrV0hZM+smb2Tm6EY6UENjQISV58M79hHiqMzB8 KGhg==
- In-reply-to: <555A538E.2000100@usit.uio.no>
- References: <CACQ93fCmrZgWAFi5dKFC-LTG6h+GcjpTENqm-w=QLbi-ab6JJA@mail.gmail.com> <55523A13.8070306@symas.com> <555A538E.2000100@usit.uio.no>
On Mon, 2015-05-18 at 23:03 +0200, Hallvard Breien Furuseth wrote:
> On 12/05/15 19:36, Howard Chu wrote:
> > Dmytro Milinevskyy wrote:
> > > Basically I need to have an opportunity to call mdb_get while in
> > > write
> > > transaction.
> > > The sequence is smth like:
> > > - txn = mdb_txn_begin(flags=0)
> > > for i in 0..x:
> > > - v = mdb_get(txn, i)
> > > - mdb_put(txn, x+i, v)
> > > - mdb_put(txn, i, v+1)
> > > - mdb_txn_commit(txn)
> > >
> > > Will it be always valid data?
> >
> > Yes.
>
> ...No. I expect he means v = the MDB_val returned by mdb_get().
> mdb_put() can modify the data it points at.
>
> See the MDB_val documentation in ldmb.h:
> * Values returned from the database are valid only until a
> subsequent
> * update operation, or the end of the transaction. Do not modify or
> * free them, they commonly point into the database itself.
>
What exactly does a subsequent update operation mean? Overwriting the
value of the same key, or any mdb_put or mdb_cursor_put operation at
all, regardless of which key they touch?