sidnt / lmdz

0 stars 0 forks source link

mdb_put() vs mdb_txn_commit() #23

Open sidnt opened 4 years ago

sidnt commented 4 years ago

test whether the changes of mdb_put() are persisted after it returns, or at the point where the referenced transaction is committed

sidnt commented 4 years ago

an mdb_put means that the data is being written to the copied-on-write data.

to make these changes permanent into the db, we commit this transaction, which updates the tree.


wipland

mdb_put instance carry a transaction and a database handle. shares an MDB_txn with all its other siblings in the transaction.

sidnt commented 4 years ago

mdb_put is interesting. it is not mdb_env_put / mdb_txn_put / mdb_dbi_put

mdb_put (
  txn-handle,
  dbi-handle, key, value,
  flags-for-this-mdb_put
)
sidnt commented 4 years ago

mdb is transactional. and it is unopinionated what key mutations are grouped in what transactions. so one transaction target an arbitrary collection of keys in an lmdb environment. other transaction can target other sets. these sets could intersect. two transactions might have an overlapping area of keys that they both intend to modify. that won't be a problem, because anyway read-write transactions are fully serialised.