Skip to content

[stable2606] Backport #12106#12678

Open
paritytech-release-backport-bot[bot] wants to merge 1 commit into
stable2606from
backport-12106-to-stable2606
Open

[stable2606] Backport #12106#12678
paritytech-release-backport-bot[bot] wants to merge 1 commit into
stable2606from
backport-12106-to-stable2606

Conversation

@paritytech-release-backport-bot

Copy link
Copy Markdown

Backport #12106 into stable2606 from karolk91.

See the documentation on how to use this bot.

…2106)

Fix a kvdb refcount-leak: multiple `Store`/`Reference`/`Release` ops on
the same key in one `sp_database::Transaction` each read a stale on-disk
counter and write back to the same counter key — the underlying
`DBTransaction` keeps only the last `put`, collapsing N ops to a single
±1. `commit_impl` now aggregates per-`(col, key)` deltas first and
performs one read-modify-write per unique key.

Surfaces when multiple displaced fork branches at the same height carry
the same indexed extrinsics. `prune_displaced_branches` then issues
`release(col11, hash) × N` per fork **in one finalization commit** —
pre-fix only one decrement landed, leaving indexed transaction data
reachable past its retention period.

Adds parametrized tests across `KvdbMemdb` / `ParityDb` / `RocksDb`
covering same-commit `Store + 2× Release`, `Store + 2× Reference`, and
`Store + Release` net-zero patterns. All three failed on the kvdb
backends pre-fix; all pass post-fix.

---------

Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Branislav Kontur <bkontur@gmail.com>
Co-authored-by: Bastian Köcher <git@kchr.de>
(cherry picked from commit 91d93d4)
@github-actions github-actions Bot added the A3-backport Pull request is already reviewed well in another branch. label Jul 17, 2026
@github-actions
github-actions Bot requested a review from karolk91 July 17, 2026 17:14
@github-actions

Copy link
Copy Markdown
Contributor

This pull request is amending an existing release. Please proceed with extreme caution,
as to not impact downstream teams that rely on the stability of it. Some things to consider:

  • Backports are only for 'patch' or 'minor' changes. No 'major' or other breaking change.
  • Should be a legit fix for some bug, not adding tons of new features.
  • Must either be already audited or not need an audit.
Emergency Bypass

If you really need to bypass this check: add validate: false to each crate
in the Prdoc where a breaking change is introduced. This will release a new major
version of that crate and all its reverse dependencies and basically break the release.

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

Labels

A3-backport Pull request is already reviewed well in another branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant