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

Re: lmdb - atomic actions



Tomer Doron wrote:
wondering what the best strategy to achieve atomic updates with LMDB.

what i am trying to achieve is a read then update atomic action given a
highly concurrent use case,  for example, if a key/value pair represents a
counter, how does one increment or decrement the counter atomically.

i am pretty sure mdb_get -> mdv_set sequence is not atomic, wondering if
mdb_cursor_get -> mdv_cursor_put sequence is? perhaps a certain flag is
required on the get action to achieve a lock? in my bdb implementation i
used lockers to achieve this.

Transactions are atomic. Whatever operations you perform in a single transaction will occur atomically. BDB-style locking is unnecessary.

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