[php-src] Issue #8856: dba: lmdb: allow to override the MDB_NOSUBDIR flag

From: Date: Thu, 23 Jun 2022 18:38:53 +0000
Subject: [php-src] Issue #8856: dba: lmdb: allow to override the MDB_NOSUBDIR flag
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-241798@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8856 Author: martinvonwittich ### Description The lmdb driver of DBA always sets the MDB_NOSUBDIR flag and does not allow PHP code to override it: https://github.com/php/php-src/blob/bc03deec278923045235f470b4969bab358feaa2/ext/dba/dba_lmdb.c#L43 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.

« previous php.bugs (#241798) next »