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

*: do not return row not match parition error when using update ingore #50134

Merged
merged 1 commit into from
Jan 8, 2024

Conversation

lcwangchao
Copy link
Collaborator

What problem does this PR solve?

Issue Number: close #50128

What changed and how does it work?

  • when using update ignore ... , error should not return to user
  • always appending warning when update ignore

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 5, 2024
@@ -186,15 +186,17 @@ func updateRecord(
memBuffer.Release(sh)
return true, nil
}(); err != nil {
if terr, ok := errors.Cause(err).(*terror.Error); sctx.GetSessionVars().StmtCtx.IgnoreNoPartition && ok && terr.Code() == errno.ErrNoPartitionForGivenValue {
if terr, ok := errors.Cause(err).(*terror.Error); sctx.GetSessionVars().StmtCtx.IgnoreNoPartition && ok && (terr.Code() == errno.ErrNoPartitionForGivenValue || terr.Code() == errno.ErrRowDoesNotMatchGivenPartitionSet) {
sctx.GetSessionVars().StmtCtx.AppendWarning(err)
Copy link
Collaborator Author

@lcwangchao lcwangchao Jan 5, 2024

Choose a reason for hiding this comment

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

We should append error to warning when "update/insert ignore" to keep the behavior same with mysql

@@ -7,7 +7,7 @@ partition by list (id*2 + b*b + b*b - b*b*2 - abs(id)) (
partition p0 values in (3,5,6,9,17),
partition p1 values in (1,2,10,11,19,20),
partition p2 values in (4,12,13,14,18),
partition p3 values in (7,8,15,16,null)
partition p3 values in (7,8,15,16,27,null)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This modification here is to make the later test stable:

update t set id=id+17 where id in (3,10);
Error 1062 (23000): Duplicate entry '20-2' for key 't.idx'

Without this line of change, there will be two errors in the statement and any of them can be returned first.

@lcwangchao lcwangchao requested a review from Defined2014 January 5, 2024 09:49
@lcwangchao lcwangchao changed the title executor: do not return row not match parition error when using update ingore *: do not return row not match parition error when using update ingore Jan 5, 2024
@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jan 5, 2024
Copy link
Member

@YangKeao YangKeao left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

ti-chi-bot bot commented Jan 5, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Defined2014, YangKeao

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [Defined2014,YangKeao]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jan 5, 2024
Copy link

ti-chi-bot bot commented Jan 5, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-01-05 09:54:48.758388284 +0000 UTC m=+5078.342641969: ☑️ agreed by Defined2014.
  • 2024-01-05 09:57:18.889656538 +0000 UTC m=+5228.473910225: ☑️ agreed by YangKeao.

@lcwangchao
Copy link
Collaborator Author

/retest

Copy link

codecov bot commented Jan 5, 2024

Codecov Report

Merging #50134 (bf1ff21) into master (b4ba24b) will decrease coverage by 12.0410%.
Report is 9 commits behind head on master.
The diff coverage is 100.0000%.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #50134         +/-   ##
=================================================
- Coverage   79.3242%   67.2832%   -12.0410%     
=================================================
  Files          2445       2558        +113     
  Lines        673508     839885     +166377     
=================================================
+ Hits         534255     565102      +30847     
- Misses       117867     251099     +133232     
- Partials      21386      23684       +2298     
Flag Coverage Δ
integration 36.5877% <100.0000%> (?)
unit 79.3061% <0.0000%> (-0.0181%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 73.6130% <ø> (ø)
parser ∅ <ø> (∅)
br 71.8250% <ø> (+3.3307%) ⬆️

@hawkingrei
Copy link
Member

/test all

Copy link

tiprow bot commented Jan 8, 2024

@lcwangchao: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
tiprow_fast_test bf1ff21 link true /test tiprow_fast_test

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@lcwangchao
Copy link
Collaborator Author

/retest

@ti-chi-bot ti-chi-bot bot merged commit 2253f29 into pingcap:master Jan 8, 2024
19 of 20 checks passed
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.1: #50159.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Jan 8, 2024
ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Jan 8, 2024
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.5: #50160.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.1: #50161.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Jan 8, 2024
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-5.4: #50162.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Jan 8, 2024
@lcwangchao lcwangchao deleted the fix_50128 branch January 8, 2024 04:46
AilinKid pushed a commit to AilinKid/tidb that referenced this pull request Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

error still returns when updating record to the unmatched partition using update ignore ...
5 participants