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

chore: Introduce LockKey for LockTable #2463

Merged
merged 1 commit into from
Jan 28, 2024
Merged

chore: Introduce LockKey for LockTable #2463

merged 1 commit into from
Jan 28, 2024

Conversation

romange
Copy link
Collaborator

@romange romange commented Jan 23, 2024

This should reduce allocations in a common case (not multi). In addition, rename Transaction::args_ to kv_args_.

@romange romange requested a review from dranikpg January 23, 2024 18:18
@romange romange marked this pull request as ready for review January 24, 2024 04:31
src/server/table.h Outdated Show resolved Hide resolved
src/server/table.h Outdated Show resolved Hide resolved
dranikpg
dranikpg previously approved these changes Jan 24, 2024
Copy link
Contributor

@dranikpg dranikpg left a comment

Choose a reason for hiding this comment

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

Not against it, but if you want I can take care of the simpler solution

@dranikpg
Copy link
Contributor

@romange PTAL. I can't request a review because it's your PR

@romange
Copy link
Collaborator Author

romange commented Jan 28, 2024

@dranikpg and I can not approve because it's my PR 👯‍♂️ . Once it passes tests, please approve and I will submit 😆

This should reduce allocations in a common case (not multi).
In addition, rename Transaction::args_ to kv_args_.

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
Comment on lines +92 to +99

auto begin() const {
return locks_.cbegin();
}

auto end() const {
return locks_.cbegin();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually interesting how this leaks a private type but the compiler doesn't complain 🤷🏻‍♂️

Copy link
Contributor

Choose a reason for hiding this comment

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

apparently it's a language feature

auto s = KeyLockArgs::GetLockKey(lock_args.args[i]);
auto it = lt.find(s);
if (it != lt.end() && !it->second.Check(mode)) {
string_view s = KeyLockArgs::GetLockKey(lock_args.args[i]);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

CheckLock is used now only for debug/testing code.

@romange romange merged commit d608ec9 into main Jan 28, 2024
10 checks passed
@romange romange deleted the Pr1 branch January 28, 2024 10:19
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

Successfully merging this pull request may close these issues.

None yet

3 participants