-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Push down condition check to TiKV for prewrite
request
#9127
Push down condition check to TiKV for prewrite
request
#9127
Conversation
Signed-off-by: zhangjinpeng1987 <zhangjinpeng@pingcap.com>
Signed-off-by: zhangjinpeng1987 <zhangjinpeng@pingcap.com>
Signed-off-by: zhangjinpeng1987 <zhangjinpeng@pingcap.com>
Signed-off-by: zhangjinpeng1987 <zhangjinpeng@pingcap.com>
Signed-off-by: zhangjinpeng1987 <zhangjinpeng@pingcap.com>
Signed-off-by: zhangjinpeng1987 <zhangjinpeng@pingcap.com>
Signed-off-by: zhangjinpeng1987 <zhangjinpeng@pingcap.com>
Signed-off-by: zhangjinpeng1987 <zhangjinpeng@pingcap.com>
Signed-off-by: zhangjinpeng1987 <zhangjinpeng@pingcap.com>
Signed-off-by: zhangjinpeng1987 <zhangjinpeng@pingcap.com>
Signed-off-by: zhangjinpeng1987 <zhangjinpeng@pingcap.com>
Signed-off-by: zhangjinpeng1987 <zhangjinpeng@pingcap.com>
Signed-off-by: zhangjinpeng1987 <zhangjinpeng@pingcap.com>
Signed-off-by: zhangjinpeng1987 <zhangjinpeng@pingcap.com>
Signed-off-by: zhangjinpeng1987 <zhangjinpeng@pingcap.com>
Signed-off-by: zhangjinpeng1987 <zhangjinpeng@pingcap.com>
Signed-off-by: zhangjinpeng1987 <zhangjinpeng@pingcap.com>
Signed-off-by: zhangjinpeng1987 <zhangjinpeng@pingcap.com>
Signed-off-by: zhangjinpeng1987 <zhangjinpeng@pingcap.com>
I suggest handle
This may result in worse performance, but the code is much simpler. |
Signed-off-by: zhangjinpeng1987 <zhangjinpeng@pingcap.com>
Signed-off-by: zhangjinpeng1987 <zhangjinpeng@pingcap.com>
store/tikv/2pc.go
Outdated
if err == nil { | ||
panic(fmt.Sprintf("con:%d, precondition error for key:%s should not be nil", c.connID, key)) | ||
} | ||
log.Errorf("con:%d key: %s already exists", c.connID, 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.
Why log error here? key already exists
is a normal business logic.
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 think it is better to log duplicated entry error in TiDB.
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 agree with tiancaiamao, if we log the duplicated error, there will be too many useless logs.
… into prewrite-not-exist
@disksing PTAL |
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.
reset LGTM
store/tikv/2pc.go
Outdated
if err == nil { | ||
panic(fmt.Sprintf("con:%d, precondition error for key:%s should not be nil", c.connID, key)) | ||
} | ||
log.Errorf("con:%d key: %s already exists", c.connID, 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.
I agree with tiancaiamao, if we log the duplicated error, there will be too many useless logs.
Signed-off-by: zhangjinpeng1987 <zhangjinpeng@pingcap.com>
LGTM |
@winkyao PTAL again. |
/run-all-tests |
/run-integration-tests |
LGTM |
What problem does this PR solve?
Push down condition check to TiKV for
Insert
request.What is changed and how it works?
Push down condition check to TiKV, and the batch_get for insert statement with unique constraint can be removed.
Check List
Tests
Code changes
Related PRs
Push down precondition to TiKV kvproto#343
prewrite only when keys are not exist tikv/tikv#4085
These two PRs should be merged first.