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

lmdb - atomic actions

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.