-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
We can't write the entries of one database into another #189
Comments
Hey @hyc 👋 Do you have any advice on these points:
Have a nice day 🌞 |
|
Thank you for the info, Howard! Unfortunately, the changes made in #190 are invalid as the following rule is no more ensured at compile-time:
To continue, possible solutions to enable the original limitation described by this issue. We could expose an /// Returns `N` views of a mutable transaction. Don't use it like you would use an `RwTxn`.
unsafe fn RwTxn::split<const N: usize>(&mut self) -> [SplitRwTxn; N];
let mut wtxn = env.write_txn()?;
let [mut wtxn1, mut wtxn2] = unsafe { wtxn.split() };
for result in database1.iter(&wtxn1)? {
let (k, v) = result?;
database2.put(&mut wtxn2, k, v)?;
}
// by dropping wtxn1 and wtxn2 you can commit the original wtxn
wtxn.commit()?; |
Hey @hyc 👋
I am wondering if this sentence is about a subsequent update operation in the database or over the whole environment. Is the cursor cache shared between databases, and therefore, pointers can become invalid after new writes?
Does that mean we can create a nested read-only transaction from a write transaction and send that read-only transaction to another thread? Have a nice day 🌵 |
It is for the whole environment. While databases are generally independent, if a transaction gets a large enough number of dirty pages, buffers will get flushed and re-used.
No. Read-only txns don't support nesting. |
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
.The text was updated successfully, but these errors were encountered: