-
Notifications
You must be signed in to change notification settings - Fork 8k
Description
Description
The lmdb driver of DBA always sets the MDB_NOSUBDIR flag and does not allow PHP code to override it:
Line 43 in bc03dee
| int rc, 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 files data.mdb and lock.mdb in this directory. When using PHP, one has to open subdir/data.mdb explicitly, but now the PHP code will use subdir/data.mdb-lock instead of subdir/lock.mdb as a lock file, leading to two separate lock files when using different codebases:
host ~/test (master) # ls -l pkg.db
total 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 use MDB_NOSUBDIR too because there is no way to disable it in PHP.