meilisearch / heed

A fully typed LMDB wrapper with minimum overhead 🐦
https://docs.rs/heed
MIT License
508 stars 52 forks source link

Checking for already opened LMDB Environments #180

Open darnuria opened 1 year ago

darnuria commented 1 year ago

Heed strive to pursue opening LMDB safely, so a database environment must be opened only once inside a process address space.

Any subsequent opening shall return the corresponding already opened environment.

It was done with Path Canonization but it fails to tackle symlinks, hardlinks and renaming/move of the whole database environment (both locks and database).

In an ideal world the environment already open checking must prevail:

Related pull requests/ Issue

Open question

Is Canonization still pertinant if we check already-openned by Unix: (device/inode) Windows: (Driver/fileID) through same_file?

How to do it compatible with windows without lefting file open.

Problems

Lmdb rely on Unixes on posix filelocking through fnctl

darnuria commented 11 months ago

@Kerollmops would suggest removing from 0.20.0 this issue the solution may cause more trouble than the initial issue.