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

Re: (LMDB) Correct use of mdb_env_sync



Pierre Chapuis wrote:
I am having a hard time understanding how exactly mdb_env_sync should
be used. Suppose I have an environment with MDB_NOSYNC and I do not use
MDB_WRITEMAP. I still want to sync at some points, which is why
mdb_env_sync exists. But I wonder:

- How does it interact with transactions? Is it safe (or necessary) to
   call it outside of a transaction? During a read-only transaction?
   During a write transaction?

Since mdb_env_sync() doesn't take a txn as a parameter, it is impossible to call it inside of a transaction.

- What about thread safety? Can it be called concurrently with writes?
   Can it be called concurrently with another mdb_env_sync in another
   thread?

Try it and see.

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