You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been trying to find a way to list all the named databases present in an environment, but neither here nor in the C library there seems to be any functionality to do so. The naive solution of iterating all keys in the unnamed database only works if you don't store any normal keys there. The closest I've got is to try and db_open every key found, but that would not be practical in the general case, and I am not sure if it would work depending on the flags used to create the DB.
The only reliable way I've found to do this requires accessing the internal C structures and check the Node flags ((node->mn_flags & (F_DUPDATA|F_SUBDATA)) != F_SUBDATA) as the mdb_dbi_open function does (code).
Hi,
I have been trying to find a way to list all the named databases present in an environment, but neither here nor in the C library there seems to be any functionality to do so. The naive solution of iterating all keys in the unnamed database only works if you don't store any normal keys there. The closest I've got is to try and
db_open
every key found, but that would not be practical in the general case, and I am not sure if it would work depending on the flags used to create the DB.The only reliable way I've found to do this requires accessing the internal C structures and check the Node flags (
(node->mn_flags & (F_DUPDATA|F_SUBDATA)) != F_SUBDATA
) as themdb_dbi_open
function does (code).The
mdb_stat
tool has a way to iterate databases, which seems to be to iterate all keys in the main DB and check for the absence of a\x00
value (?): https://sources.debian.org/src/lmdb/0.9.24-1/libraries/liblmdb/mdb_stat.c/#L229It would be great to have this functionality added to the python bindings.
The text was updated successfully, but these errors were encountered: