Skip to content

[backport 3.3] salad: reserve block before bps_tree_insert_first_elem#11885

Merged
sergepetrenko merged 1 commit intorelease/3.3from
backport/release/3.3/11857
Oct 9, 2025
Merged

[backport 3.3] salad: reserve block before bps_tree_insert_first_elem#11885
sergepetrenko merged 1 commit intorelease/3.3from
backport/release/3.3/11857

Conversation

@TarantoolBot
Copy link
Collaborator

@TarantoolBot TarantoolBot commented Oct 7, 2025

(This PR is a backport of #11857 to release/3.3 to a future 3.3.4 release.)


The commit 51c56d9 ("salad: reserve extents for matras_touch on BPS tree operations") already made the tree self-sufficient - reserved blocks in garbage and extents for matras_touch calls prior to insertion and deletion. However, it didn't account for the addition of the first element to the tree, which creates the root leaf - this could also trigger matras_touch in bps_tree_garbage_pop.

However, it turns out there is no need to touch blocks before taking them out of the garbage. There is an invariant that blocks in the garbage are definitely not used by any read views. Although from the point of view of the matras, they require copying and could potentially have been needed by these read views. Let's just remove this matras_touch from bps_tree_garbage_pop. Also let's reserve a block in the garbage before calling bps_tree_insert_first_elem to bring the tree even closer to self-sufficiency.

Closes #11788

NO_DOC=bugfix

The commit 51c56d9 ("salad: reserve extents for matras_touch on BPS
tree operations") already made the tree self-sufficient - reserved
blocks in garbage and extents for `matras_touch` calls prior to insertion
and deletion. However, it didn't account for the addition of the first
element to the tree, which creates the root leaf - this could also trigger
`matras_touch` in `bps_tree_garbage_pop`.

However, it turns out there is no need to touch blocks before taking them
out of the garbage. There is an invariant that blocks in the garbage are
definitely not used by any read views. Although from the point of view of
the matras, they require copying and could potentially have been needed by
these read views. Let's just remove this `matras_touch` from
`bps_tree_garbage_pop`. Also let's reserve a block in the garbage before
calling `bps_tree_insert_first_elem` to bring the tree even closer to
self-sufficiency.

Closes #11788

NO_DOC=bugfix

(cherry picked from commit 52b3d4b)
@TarantoolBot TarantoolBot requested a review from a team as a code owner October 7, 2025 08:33
@TarantoolBot TarantoolBot changed the title [Backport release/3.3] salad: reserve block before bps_tree_insert_first_elem [backport 3.3] salad: reserve block before bps_tree_insert_first_elem Oct 7, 2025
@coveralls
Copy link

Coverage Status

coverage: 87.561% (-0.001%) from 87.562%
when pulling dc2c8ac on backport/release/3.3/11857
into c34103b
on release/3.3
.

@sergepetrenko sergepetrenko merged commit 690ac01 into release/3.3 Oct 9, 2025
24 checks passed
@sergepetrenko sergepetrenko deleted the backport/release/3.3/11857 branch October 9, 2025 14:21
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.

4 participants