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

Re: lmdb: is read operation permitted inside the write transaction?



Dmytro Milinevskyy wrote:
Hello,

this might be a trivial question for you but I didn't find anything in the
documentation nor any mention in the examples.

Which examples did you look at? mtest.c (and others) all operate this way already.

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.

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