-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
txn:improvement for point get by unique key or pk #1608
Conversation
…ts==uint64::max(which means is a point get by pk or unique_key in tidb)
PTAL @hhkbp2 |
src/storage/mvcc/reader.rs
Outdated
ts: lock.ts, | ||
ttl: lock.ttl, | ||
}); | ||
let raw_key = try!(key.raw()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move it into if ts == u64::MAX
.
src/storage/mvcc/reader.rs
Outdated
if ts == u64::MAX && raw_key == primary_key { | ||
// when ts==MAX(which means it's a point get by pk or unique key), | ||
// and current key is the primary key, | ||
// return latest commit version's value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks strange for MVCC to be mixed with the concept of pk or unique key. Maybe better to extract a get_latest(&mut self, key: &Key)
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think is a good idea to extract get_latest(&mut self, key: &Key)
since we use this through coprocessor, use get_latest
may change too much.
PTAL |
src/storage/mvcc/reader.rs
Outdated
ttl: lock.ttl, | ||
}); | ||
if ts == u64::MAX && try!(key.raw()) == lock.primary { | ||
// when ts==MAX(which means get latest committed version for primary key), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/ts== MAX(which means get / ts == u64::MAX (which means to get/
Rest LGTM |
LGTM |
PTAL @hhkbp2 |
any performance increased? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR implement improvement for point get by unique key or pk with tidb.
For
Get
with ts==uint64::max(which means it's a point get by pk or unique_key from tidb), if lock exist and current key the primary, return latest committed version instead of ErrorWithLock.@disksing @zhangjinpeng1987 PTAL