- Notifications
You must be signed in to change notification settings - Fork8k
Description
Description
Thelmdb
driver of DBA always sets theMDB_NOSUBDIR
flag and does not allow PHP code to override it:
Line 43 inbc03dee
intrc,flags=MDB_NOSUBDIR; |
This is a problem for interoperability when sharing a single LMDB database between multiple programs written in different languages. LMDB itself defaults to using a subdirectory as a database, and will create two filesdata.mdb
andlock.mdb
in this directory. When using PHP, one has to opensubdir/data.mdb
explicitly, but now the PHP code will usesubdir/data.mdb-lock
instead ofsubdir/lock.mdb
as a lock file, leading to two separate lock files when using different codebases:
host ~/test (master) # ls -l pkg.dbtotal 156K-rw------- 1 root root 148K Jun 22 16:49 data.mdb-rw------- 1 root root 8.0K Jun 23 19:30 lock.mdb-rw-r--r-- 1 root root 8.0K Jun 22 18:49 data.mdb-lock
Currently, the only way to work around this issue is by changing all other codebases to useMDB_NOSUBDIR
too because there is no way to disable it in PHP.