Skip to content

storage: let LMDB implement the async storage traits - #415

Closed
alexskinner wants to merge 1 commit into
KipData:mainfrom
alexskinner:upstream/lmdb-async
Closed

alexskinner wants to merge 1 commit into
KipData:mainfrom
alexskinner:upstream/lmdb-async

Conversation

@alexskinner

Copy link
Copy Markdown
Collaborator

Make LMDB usable on the async path so applications using async storage (such as SlateDB) can also open local LMDB databases in the same build:

  • Own Arc<Environment> in LmdbTransaction, implement the maybe_async storage traits as immediately-ready futures, and manage txn/cursor lifetimes through raw LMDB pointers. Sync behaviour is unchanged.
  • Relax the lib.rs feature gate so async + lmdb builds (while async + rocksdb stays excluded).
  • Update LMDB storage tests for maybe_async, add a build-lmdb-async Makefile/CI target, document the combination in docs/features.md, and add examples/async_lmdb.rs.

Make LMDB usable on the async path by owning Arc<Environment> in
LmdbTransaction, implementing the maybe_async storage traits as
immediately-ready futures, and managing txn/cursor lifetimes through
raw LMDB pointers. Sync behaviour is unchanged.

Relax the lib.rs feature gate so async+lmdb builds, while async+rocksdb
stays excluded. Mark the LMDB storage tests with maybe_async, convert
the remove_range/range_rev/explicit-transaction checks, and add a
Makefile/CI build for async+lmdb. Document the combination and add an
async_lmdb example.

Co-authored-by: Alex Skinner <alexskinner@users.noreply.github.com>
@codecov

codecov Bot commented Nov 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.27586% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.09%. Comparing base (34a2123) to head (95d7135).

Files with missing lines Patch % Lines
src/storage/lmdb.rs 98.27% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #415      +/-   ##
==========================================
+ Coverage   93.08%   93.09%   +0.01%     
==========================================
  Files         282      282              
  Lines       39885    39978      +93     
==========================================
+ Hits        37125    37218      +93     
  Misses       2760     2760              
Flag Coverage Δ
rust 93.09% <98.27%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/storage/lmdb.rs 94.08% <98.27%> (+2.09%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@KKould

KKould commented Nov 27, 2026

Copy link
Copy Markdown
Member

In my view, the changes introduced to implement asynchronous support in LMDB compromise its inherent simplicity and clarity, while also negatively impacting performance to some extent. I do not believe that enabling asynchronous operation justifies modifying LMDB; there are likely better ways to achieve this.

@KKould KKould closed this Nov 27, 2026
@alexskinner

Copy link
Copy Markdown
Collaborator Author

Thanks, understood, and agreed that LMDB should stay simple. For context, the goal was letting one async application use a local-file datasource alongside an object-store (SlateDB) one. We will do that outside core instead: either an async LMDB Storage implementation in our own driver crate, plugged in through build_with_storage, or SlateDB on a local filesystem object store. No changes to KiteSQL needed. Thanks for the review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants