-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
statedb: Fix read-after-write bug #31164
Merged
joamaki
merged 2 commits into
cilium:main
from
joamaki:pr/joamaki/fix-statedb-read-after-write
Mar 6, 2024
Merged
statedb: Fix read-after-write bug #31164
joamaki
merged 2 commits into
cilium:main
from
joamaki:pr/joamaki/fix-statedb-read-after-write
Mar 6, 2024
Conversation
This file contains 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
The optimization to reuse the last used "indexReadTxn" was broken when a WriteTxn was first used for a read and then for a write followed by a read (the last read re-used an old transaction). Add test to observe this bug. Signed-off-by: Jussi Maki <jussi@isovalent.com>
joamaki
added
release-note/bug
This PR fixes an issue in a previous release of Cilium.
needs-backport/1.15
This PR / issue needs backporting to the v1.15 branch
labels
Mar 5, 2024
/test |
The optimization in *txn to hold the last used index read transaction to avoid a hash map lookup was broken as the write txn used for reading was cloned, leading to not being able to read any of the future writes in the same transaction. Benchmark show that this optimization does not actually help, so solve the problem by removing the optimization. Before: BenchmarkDB_RandomLookup-8 1000000 1471 ns/op After: BenchmarkDB_RandomLookup-8 1000000 1485 ns/op Fixes: d0d4d46 ("statedb: Store index unique info in the index tree entry") Signed-off-by: Jussi Maki <jussi@isovalent.com>
joamaki
force-pushed
the
pr/joamaki/fix-statedb-read-after-write
branch
from
March 5, 2024 16:29
cb3839f
to
a3cf05e
Compare
/test |
bimmlerd
approved these changes
Mar 6, 2024
maintainer-s-little-helper
bot
added
the
ready-to-merge
This PR has passed all tests and received consensus from code owners to merge.
label
Mar 6, 2024
jibi
added
backport-pending/1.15
The backport for Cilium 1.15.x for this PR is in progress.
and removed
needs-backport/1.15
This PR / issue needs backporting to the v1.15 branch
labels
Mar 12, 2024
maintainer-s-little-helper
bot
moved this from Needs backport from main
to Backport pending to v1.15
in 1.15.2
Mar 12, 2024
jibi
added
needs-backport/1.15
This PR / issue needs backporting to the v1.15 branch
and removed
backport-pending/1.15
The backport for Cilium 1.15.x for this PR is in progress.
labels
Mar 13, 2024
maintainer-s-little-helper
bot
moved this from Backport pending to v1.15
to Needs backport from main
in 1.15.2
Mar 13, 2024
jibi
added
backport-pending/1.15
The backport for Cilium 1.15.x for this PR is in progress.
and removed
needs-backport/1.15
This PR / issue needs backporting to the v1.15 branch
labels
Mar 13, 2024
github-actions
bot
removed
the
backport-pending/1.15
The backport for Cilium 1.15.x for this PR is in progress.
label
Mar 16, 2024
github-actions
bot
added
the
backport-done/1.15
The backport for Cilium 1.15.x for this PR is done.
label
Mar 16, 2024
jrajahalme
moved this from Needs backport from main
to Backport done to v1.15
in 1.15.3
Mar 26, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backport-done/1.15
The backport for Cilium 1.15.x for this PR is done.
ready-to-merge
This PR has passed all tests and received consensus from code owners to merge.
release-note/bug
This PR fixes an issue in a previous release of Cilium.
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.
statedb: Fix read-after-write bug
The optimization in *txn to hold the last used index read transaction
to avoid a hash map lookup was broken as the write txn used for reading
was cloned, leading to not being able to read any of the future writes
in the same transaction.
Benchmark show that this optimization does not actually help, so solve
the problem by removing the optimization.
Before:
BenchmarkDB_RandomLookup-8 1000000 1471 ns/op
After:
BenchmarkDB_RandomLookup-8 1000000 1485 ns/op
Fixes: d0d4d46 ("statedb: Store index unique info in the index tree entry")
Note that v1.14 does not have the "StateDB v2.0", so it is not affected by this.