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

race condition in OptimisticTransaction::CommitWithParallelValidate #10663

Open
andoryu- opened this issue Sep 13, 2022 · 2 comments
Open

race condition in OptimisticTransaction::CommitWithParallelValidate #10663

andoryu- opened this issue Sep 13, 2022 · 2 comments

Comments

@andoryu-
Copy link

andoryu- commented Sep 13, 2022

Note: Please use Issues only for bug reports. For questions, discussions, feature requests, etc. post to dev group: https://groups.google.com/forum/#!forum/rocksdb or https://www.facebook.com/groups/rocksdb.dev

Expected behavior

OptimisticTransaction::CommitWithParallelValidate() actually prevent race between TransactionUtil::CheckKeysForConflicts() and DBImpl::Write(), as implied by its example code

Actual behavior

OptimisticTransaction::CommitWithParallelValidate() cannot prevect race between TransactionUtil::CheckKeysForConflicts() and DBImpl::Write()

Steps to reproduce the behavior

Read the source code, sepcifically between calling TransactionUtil::CheckKeysForConflicts and calling DBImpl::Write()

The moment thread T1 has just done executing L123, another thread T2 write something into db, then T1 executes L129, the transaction will falsely commit, contrary to what is implied by the occ example code

@andoryu- andoryu- changed the title race in OptimisticTransaction::CommitWithParallelValidate race condition in OptimisticTransaction::CommitWithParallelValidate Sep 16, 2022
@ywave620
Copy link
Contributor

I think the entire OptimisticTransaction::CommitWithParallelValidate() is protected by a lock.

@zergvszerg
Copy link

I think the entire OptimisticTransaction::CommitWithParallelValidate() is protected by a lock.

@ywave620
However the lock only guarantee mutual exclusion between transactions, not including DB::Write().

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

No branches or pull requests

3 participants