Skip to content
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

Refresh() is not supported by vector memtable which may lead to an error in db_stress #12286

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ofriedma
Copy link

How to reproduce:

./db_stress --clear_column_family_one_in=0 --column_families=1 --destroy_db_initially=1 --key_len_percent_dist=100 --kill_random_test=0 --max_key=102400 --max_key_len=1 --verify_iterator_with_expected_state_one_in=1 --iterpercent=13 --readpercent=20 --writepercent=67 --delpercent=0 --delrangepercent=0 --prefixpercent=0 -column_families=1 -memtablerep=vector

error is:

Verification failed. Expected state has key 0000000000008CD1, iterator is at key 0000000000008C97
Column family: default, op_logs: S 0000000000008CCC N SFP 0000000000008CD5 PRefresh S 0000000000008CD1 P
2024/01/24-17:10:03 Starting verification
Stress Test : 1194.578 micros/op 26618 ops/sec
: Wrote 0.08 MB (0.28 MB/sec) (67% of 8147 ops)
: Wrote 5496 times
: Deleted 0 times
: Single deleted 0 times
: 1606 read and 50 found the key
: Prefix scanned 0 times
: Iterator size sum is 0
: Iterated 1044 times
: Deleted 0 key-ranges
: Range deletions covered 0 keys
: Got errors 1 times
: 0 CompactFiles() succeed
: 0 CompactFiles() did not succeed
Verification failed :(

After the fix there is no error

@facebook-github-bot
Copy link
Contributor

Hi @ofriedma!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@ofriedma ofriedma force-pushed the wip-ofriedma-add-iter-refresh-check branch from 4ab28bd to e231df1 Compare January 24, 2024 15:38
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

include/rocksdb/iterator.h Outdated Show resolved Hide resolved
@ofriedma ofriedma force-pushed the wip-ofriedma-add-iter-refresh-check branch from e231df1 to 4b868da Compare January 25, 2024 08:22
@ofriedma ofriedma requested a review from ajkr January 25, 2024 08:23
@@ -1870,7 +1870,7 @@ class NonBatchedOpsStressTest : public StressTest {

// Write-prepared and Write-unprepared do not support Refresh() yet.
if (!(FLAGS_use_txn && FLAGS_txn_write_policy != 0) &&
thread->rand.OneIn(2)) {
thread->rand.OneIn(2) && iter->IsAllowRefresh()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we instead skip the validation when iter->Refresh() returns NotSupported? Then we don't need a new method in the Iterator class.

Copy link
Author

@ofriedma ofriedma Jan 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ajkr I changed the code, IMO the IsAllowRefresh() makes the code looks better, The condition is more readable (I removed the check for use_txm and txn_write_policy since both call NetItertator with allow_refresh_ = false.
trying to revert changes after iter->Refresh() in this section ,cause errors.

@ofriedma ofriedma force-pushed the wip-ofriedma-add-iter-refresh-check branch from 4b868da to 4c6c6d2 Compare January 28, 2024 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants