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

Add GetEntityForUpdate to optimistic and WriteCommitted pessimistic transactions #12668

Closed
wants to merge 1 commit into from

Conversation

ltamasi
Copy link
Contributor

@ltamasi ltamasi commented May 16, 2024

Summary: The patch adds a new GetEntityForUpdate API to optimistic and WriteCommitted pessimistic transactions, which provides transactional wide-column point lookup functionality with concurrency control. For WriteCommitted transactions, user-defined timestamps are also supported similarly to the GetForUpdate API.

Differential Revision: D57458304

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57458304

@ltamasi ltamasi requested a review from jaykorean May 16, 2024 20:35
ltamasi added a commit to ltamasi/rocksdb that referenced this pull request May 16, 2024
…ransactions (facebook#12668)

Summary:

The patch adds a new `GetEntityForUpdate` API to optimistic and WriteCommitted pessimistic transactions, which provides  transactional wide-column point lookup functionality with concurrency control.

Differential Revision: D57458304
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57458304

ltamasi added a commit to ltamasi/rocksdb that referenced this pull request May 16, 2024
…ransactions (facebook#12668)

Summary:

The patch adds a new `GetEntityForUpdate` API to optimistic and WriteCommitted pessimistic transactions, which provides transactional wide-column point lookup functionality with concurrency control. For WriteCommitted transactions, user-defined timestamps are also supported similarly to the `GetForUpdate` API.

Differential Revision: D57458304
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57458304

…ransactions (facebook#12668)

Summary:

The patch adds a new `GetEntityForUpdate` API to optimistic and WriteCommitted pessimistic transactions, which provides transactional wide-column point lookup functionality with concurrency control. For WriteCommitted transactions, user-defined timestamps are also supported similarly to the `GetForUpdate` API.

Differential Revision: D57458304
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57458304

const Slice& key,
PinnableWideColumns* columns,
bool exclusive = true,
bool do_validate = true) = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I see other GetForUpdate APIs have const bool do_validate.

Copy link
Contributor Author

@ltamasi ltamasi May 20, 2024

Choose a reason for hiding this comment

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

Since do_validate is passed by value, declaring it as const bool vs bool doesn't really make a difference (declaring it const prevents the function's copy of do_validate from being changed in the function body but we don't do that anyway, so to me consts like this just add noise).


if (!do_validate) {
if (read_timestamp_ != kMaxTxnTimestamp) {
return Status::InvalidArgument(
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a thought. Could it be confusing to the users if we ignore do_validate being false and always just force validate when ts is set?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I think silently performing validation when the application passed in do_validate==false might be a bit confusing, especially for users migrating from GetForUpdate to GetEntityForUpdate. So this (and the below) case is where I feel it might make sense to be consistent

const ReadOptions& read_options, ColumnFamilyHandle* column_family,
const Slice& key, PinnableWideColumns* columns, bool exclusive,
bool do_validate) {
if (!do_validate && read_options.snapshot != nullptr) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Like ts, wondering if we can ignore do_validate being false and always just force validate when snapshot is set.

Copy link
Contributor

@jaykorean jaykorean left a comment

Choose a reason for hiding this comment

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

Just left a couple of questions. LGTM! Thank you

@ltamasi
Copy link
Contributor Author

ltamasi commented May 20, 2024

Thanks so much for the review @jaykorean !

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in c87f5cf.

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