forked from LMDB/lmdb
-
Notifications
You must be signed in to change notification settings - Fork 2
Allow nested rtxn from wtxn #3
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
Draft
Kerollmops
wants to merge
10
commits into
mdb.master
Choose a base branch
from
allow-nested-rtxn-from-wtxn
base: mdb.master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Kerollmops
commented
Feb 26, 2025
Kerollmops
commented
Feb 26, 2025
Kerollmops
commented
Feb 26, 2025
Kerollmops
commented
Feb 26, 2025
d9089b9 to
3ed9ea1
Compare
1 task
5e22e88 to
1c04d51
Compare
11 tasks
Use the correct stack index when adjusting other cursors pointing to the affected page and the DB has a subDB. Broken in ITS#8406.
dureuill
reviewed
Oct 23, 2025
dureuill
reviewed
Oct 23, 2025
dureuill
reviewed
Oct 23, 2025
dureuill
reviewed
Oct 23, 2025
dureuill
reviewed
Oct 23, 2025
| txn->mt_cursors = (MDB_cursor **)(txn->mt_dbs + env->me_maxdbs); | ||
| txn->mt_dbiseqs = parent->mt_dbiseqs; | ||
| /* Not useful when nested RDONLY but correctly freed in mdb_txn_end */ | ||
| txn->mt_u.dirty_list = malloc(sizeof(MDB_ID2)*MDB_IDL_UM_SIZE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider skipping if MDB_RDONLY
dureuill
reviewed
Oct 23, 2025
2c8691e to
2019715
Compare
We accept nested read-only transactions and no longer count them to accept more than a single one. We make sure that we free/close the child transactions only once the last one has been dropped. We use atomics to implement a reference-counted system to correctly drop the read transactions and the pghead only once. This is not C99 but C11-compatible.
Co-authored-by: dureuil <[email protected]>
2019715 to
41bf522
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In this PR, we accept nested read-only transactions and no longer count them to accept more than one. We free/close the child transactions only once the last one has been dropped. I am proposing this patch upstream.
We use atomics to implement a reference-counted system that correctly drops the read transactions and the pghead only once. This is not C99 but C11-compatible.
Warning
We found a memory leak in this PR. We need to take time to investigate the matter and fix it.