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

parallel occ #6240

Closed
wants to merge 5 commits into from
Closed

parallel occ #6240

wants to merge 5 commits into from

Conversation

wolfkdy
Copy link
Contributor

@wolfkdy wolfkdy commented Dec 23, 2019

This is a continuation of https://github.com/facebook/rocksdb/pull/5320/files
I open a new mr for these purposes, half a year has past since the old mr is posted so it's almost impossible to fulfill some points below on the old mr, especially 5)

  1. add validation modes for optimistic txns
  2. modify unittests to test both modes
  3. make format
  4. refine hash functor
  5. push to master

2) modify unittests to test both modes
3) make format
4) refine hash functor
@wolfkdy
Copy link
Contributor Author

wolfkdy commented Dec 23, 2019

continuous-integration/appveyor/pr says it runs for more than 90 mins and exceeded the quota.
I downloaded the log and found it ran for only 53mins, so I think it's not my fault.

Copy link
Contributor

@siying siying left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! I have some final comments. Most of them are about code styles. We are almost ready to go. Please mention the improvement in HISTORY.md.

// write-group).
// May suffer from high mutex contention, as per this link:
// https://github.com/facebook/rocksdb/issues/4402
VALIDATE_SERIAL = 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

Our naming convenstion is kValidateSerial.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for your contribution! I have some final comments. Most of them are about code styles. We are almost ready to go. Please mention the improvement in HISTORY.md.

thanks for your patience. I've resolved this. you can find it in HISTORY.md in the diff.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Our naming convenstion is kValidateSerial.

resolved

// reduce mutex contention.
// Each txn acquires locks for its write-set records in some well-defined
// order.
VALIDATE_PARALLEL
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we have number assigned in the previous value. It feels natural to assign both.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved

OccValidationPolicy validate_policy = OccValidationPolicy::VALIDATE_PARALLEL;

// NOTE(wolfkdy): works only if validate_policy ==
// OccValidationPolicy::VALIDATE_PARALLEL
Copy link
Contributor

Choose a reason for hiding this comment

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

What does NOTE(wolfkdy) mean?
.h files under include/rocksdb is visible not only to RocksDB developers, but users too. So we have higher standard to comments here. Please improve it a little bit.

Copy link
Contributor Author

@wolfkdy wolfkdy Jan 7, 2020

Choose a reason for hiding this comment

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

ummm, wolfkdy is my github's id. I used to add name after NOTE tag for potential conversations.
I've removed this to match rocksdb's standard. You can find it in the latest commit.
resolved.

};

struct OptimisticTransactionDBOptions {
OccValidationPolicy validate_policy = OccValidationPolicy::VALIDATE_PARALLEL;
Copy link
Contributor

Choose a reason for hiding this comment

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

Default behavior change needs to be explained in HISTORY.md.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved.

}
for (auto v : lk_idxes) {
lks.emplace_back(txn_db_impl->LockBucket(v));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I remember there used to be some comments explaining locking order but I can't find it anymore. Please add back the comment about how deadlock is prevented here.

Copy link
Contributor Author

@wolfkdy wolfkdy Jan 7, 2020

Choose a reason for hiding this comment

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

some explanations have been added back for this in the latest commit.

private:
// NOTE(wolfkdy): used in validation phase. Each key is hashed into some
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need NOTE(wolfkdy) here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

wolfkdy has been removed to match rocksdb's standard.

@wolfkdy
Copy link
Contributor Author

wolfkdy commented Jan 7, 2020

@siying Thanks for your patience. I've resolved all the above issues. Would you plz take a look?

auto txn_db_impl = static_cast_with_check<OptimisticTransactionDBImpl,
OptimisticTransactionDB>(txn_db_);
assert(txn_db_impl);
OccValidationPolicy policy = txn_db_impl->GetValidatePolicy();
Copy link
Contributor

Choose a reason for hiding this comment

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

Not big deal, but I feel it slightly more readable by dong a switch(txn_db_impl->GetValidatePolicy()) { case....
Considering the time zone difference, I'm not going to hold the PR because of it. But if you are interested, I encourage you to send a follow up PR for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ummm, switch/case here seems more elegant.
I will make another pr in this week.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@siying has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 1ab1231.

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

3 participants