[Date Prev][Date Next]
Re: (ITS#7651) LMDB: Uncontrolled database when opened from multiple processes
> I found an interesting issue with LMDB. I have populated the DB with a bunch of
> records and it uses ~30M on disk (after sync). Then I added a background process
> to my app and populated the database again with the same record set.
mdb_env_create(); fork(); mdb_env_open(); is invalid. An MDB_env may
only be used in the process which created it. See Caveats in lmdb.h.
This is because mdb_env_create() sets the pid which the MDB_env will use
in the lockfile. We could delay this to mdb_env_open(), then your
particular program would work but fork() after mdb_env_open() would not.
But I don't see much point in doing so.