-
Notifications
You must be signed in to change notification settings - Fork 37.7k
qa: Verify DBWrapper iterators are taking snapshots #11422
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
qa: Verify DBWrapper iterators are taking snapshots #11422
Conversation
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.
utACK
src/test/dbwrapper_tests.cpp
Outdated
@@ -204,19 +204,33 @@ BOOST_AUTO_TEST_CASE(iterator_ordering) | |||
for (int x=0x00; x<256; ++x) { | |||
uint8_t key = x; | |||
uint32_t value = x*x; | |||
BOOST_CHECK(dbw.Write(key, value)); | |||
if (!(x & 1)) |
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.
Can I haz braces before indenting?
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.
No, but I fixed it anyway :p.
edit: ACK bb8376b |
The LevelDB docs seem to indicate that an iterator will not take snapshots (even providing instructions on how to do so yourself). In several of the places we use them, we assume snapshots to have been taken. In order to make sure LevelDB doesn't change out from under us (and to prevent the next person who reads the docs from having the same fright I did), verify that snapshots are taken in our tests.
517ec72
to
bb8376b
Compare
Yes, iterators not changing under us is an important part of our leveldb usage. I remember in the past this was well-documented. I wonder when they changed the documentation to no longer say this, and what their plans here are? In any case it's good to check. |
bb8376b Verify DBWrapper iterators are taking snapshots (Matt Corallo) Pull request description: The LevelDB docs seem to indicate that an iterator will not take snapshots (even providing instructions on how to do so yourself). In several of the places we use them, we assume snapshots to have been taken. In order to make sure LevelDB doesn't change out from under us (and to prevent the next person who reads the docs from having the same fright I did), verify that snapshots are taken in our tests. Tree-SHA512: 54f24dabc294962e9c20882f61809604421a661208d1568bb107102248603e8e7c12e929ccb0812a73d4e4f23fea61f1b48e7cc24da5a7260f1d14d89ba88cd6
The LevelDB docs seem to indicate that an iterator will not take snapshots (even providing instructions on how to do so yourself). In several of the places we use them, we assume snapshots to have been taken. In order to make sure LevelDB doesn't change out from under us (and to prevent the next person who reads the docs from having the same fright I did), verify that snapshots are taken in our tests. Github-Pull: bitcoin#11422 Rebased-From: bb8376b
Summary: bb8376b Verify DBWrapper iterators are taking snapshots (Matt Corallo) Pull request description: The LevelDB docs seem to indicate that an iterator will not take snapshots (even providing instructions on how to do so yourself). In several of the places we use them, we assume snapshots to have been taken. In order to make sure LevelDB doesn't change out from under us (and to prevent the next person who reads the docs from having the same fright I did), verify that snapshots are taken in our tests. Tree-SHA512: 54f24dabc294962e9c20882f61809604421a661208d1568bb107102248603e8e7c12e929ccb0812a73d4e4f23fea61f1b48e7cc24da5a7260f1d14d89ba88cd6 Backport of Core PR11422 bitcoin/bitcoin#11422 Test Plan: make check Reviewers: deadalnix, Fabien, jasonbcox, O1 Bitcoin ABC, #bitcoin_abc Reviewed By: Fabien, jasonbcox, O1 Bitcoin ABC, #bitcoin_abc Differential Revision: https://reviews.bitcoinabc.org/D3858
bb8376b Verify DBWrapper iterators are taking snapshots (Matt Corallo) Pull request description: The LevelDB docs seem to indicate that an iterator will not take snapshots (even providing instructions on how to do so yourself). In several of the places we use them, we assume snapshots to have been taken. In order to make sure LevelDB doesn't change out from under us (and to prevent the next person who reads the docs from having the same fright I did), verify that snapshots are taken in our tests. Tree-SHA512: 54f24dabc294962e9c20882f61809604421a661208d1568bb107102248603e8e7c12e929ccb0812a73d4e4f23fea61f1b48e7cc24da5a7260f1d14d89ba88cd6
bb8376b Verify DBWrapper iterators are taking snapshots (Matt Corallo) Pull request description: The LevelDB docs seem to indicate that an iterator will not take snapshots (even providing instructions on how to do so yourself). In several of the places we use them, we assume snapshots to have been taken. In order to make sure LevelDB doesn't change out from under us (and to prevent the next person who reads the docs from having the same fright I did), verify that snapshots are taken in our tests. Tree-SHA512: 54f24dabc294962e9c20882f61809604421a661208d1568bb107102248603e8e7c12e929ccb0812a73d4e4f23fea61f1b48e7cc24da5a7260f1d14d89ba88cd6
bc3d3fa Add testcase to simulate bitcoin schema in leveldb (MapleLaker) 4f15155 Verify DBWrapper iterators are taking snapshots (Matt Corallo) 36b407e test: Replace remaining sprintf with snprintf (Wladimir J. van der Laan) e8cb38a Add test for dbwrapper iterators with same-prefix keys. (Matt Corallo) 4a4ddb8 test: Add more thorough test for dbwrapper iterators I made a silly mistake in a database wrapper where keys were sorted by char instead of uint8_t. As x86 char is signed the sorting for the block index database was messed up, resulting in a segfault due to missing records. (Wladimir J. van der Laan) 109446f chain: Add assertion in case of missing records in index db (Wladimir J. van der Laan) Pull request description: Back ported the following PRs from upstream (adaptations were needed because we aren't obfuscating the db): * bitcoin#7992. * bitcoin#9867. * bitcoin#11422. * bitcoin#17206 ACKs for top commit: random-zebra: Nice! ACK bc3d3fa Tree-SHA512: ebd811d7ee0d970247ceec2624e524df7611274f36ef7c0252712ebf247828ee091dcc6872585271fac3d7846127a997a856d7cd72eb20425e06213207ff1c7a
The LevelDB docs seem to indicate that an iterator will not take
snapshots (even providing instructions on how to do so yourself).
In several of the places we use them, we assume snapshots to have
been taken.
In order to make sure LevelDB doesn't change out from under us
(and to prevent the next person who reads the docs from having the
same fright I did), verify that snapshots are taken in our tests.