meilisearch / meilisearch/heed

We can't write the entries of one database into another

Open
#189 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement feedback
Dominant language
Rust
Stars
914
Forks
82
PR merge metrics
No merged PRs in 30d

Description

Currently, heed is too restrictive on the write transactions and do not permit certain basic operations like writing the content of one database into another as the example shows below.

According to the documentation, write transactions were designed to support this kind of operations on the same database too.
Which means that the following example could even work with the same database.

It would, therefore, be possible for heed replace the places where we use &mut RwTxn with, a less restrictive, &RwTxn.

let mut wtxn = env.write_txn()?;
for result in database1.iter(&wtxn)? {
    let (k, v) = result?;
    database2.put(&mut wtxn, k, v)?; // can't compile &mut and & of the same RwTxn used at the same time
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue points to heed's RwTxn APIs and the iter/put calls in the example; start by tracing how read iteration and writes borrow RwTxn. Check the linked LMDB transaction documentation for the intended transaction model. Done means the shown cross-database copy compiles and works without weakening existing transaction behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.