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

table: remove reading from non-specificed partitions in IODKU #24872

Merged
merged 5 commits into from
May 26, 2021

Conversation

mjonss
Copy link
Contributor

@mjonss mjonss commented May 24, 2021

What problem does this PR solve?

Issue Number: close #24746
Problem Summary: For INSERT, it was only checked that the partition to write to matched the explicit list of partitions, so if the original row was outside the list of partition[s] and ON DUPLICATE KEY was used, it would still read/check the existence of the original row and if existed + resulting row would match the listed partitions, it was allowed.

What is changed and how it works?

What's Changed:

Check the original given rows for INSERT INTO table PARTITION (list_of_partitions) ... ON DUPLICATE KEY UPDATE ... so they match the list_of_partitions.

How it Works:
When GetPartitionByRow() is called, also check if there is a specified list of partitions and if so, check the matching partition against that list.

Related changes

  • Need to cherry-pick to the release branch 5.0

Check List

Tests

  • Unit test

Side effects

  • n/a

Release note

  • Fixed issue-24746, no longer allowing INSERT INTO table PARTITION (<partitions>) ... ON DUPLICATE KEY UPDATE to read from non-listed partitions

mjonss added 2 commits May 24, 2021 17:51
Added missing 'W' in ...TableWithGiven...
In Insert ON DUPLICATE KEY UPDATE, if the inserted row was not
in the specified explicit partitioning list, it was still reading
from non listed partitions, allowing to alter data outside the
given list of partitions.
@mjonss mjonss requested review from a team as code owners May 24, 2021 16:58
@mjonss mjonss requested review from lzmhhh123 and removed request for a team May 24, 2021 16:58
@ti-chi-bot ti-chi-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 24, 2021
@github-actions github-actions bot added the sig/execution SIG execution label May 24, 2021
@ichn-hu ichn-hu mentioned this pull request May 24, 2021
@qw4990 qw4990 requested review from rebelice and qw4990 May 25, 2021 09:02
mjonss added 2 commits May 25, 2021 14:41
Minor refactoring, taking advantage of overloading functionality
of partitionTableWithGivenSets on top of partitionTable.

Also renamed 'partitions' to 'givenSetPartition' for clarity
and not overload the partitionTable.partitions variable.
Copy link
Contributor

@rebelice rebelice left a comment

Choose a reason for hiding this comment

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

/lgtm

@ti-chi-bot
Copy link
Member

@rebelice: Thanks for your review. The bot only counts /lgtm from reviewers and higher roles in list, but you're still welcome to leave your comments.

In response to this:

/lgtm

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 ti-community-infra/tichi repository.

@qw4990 qw4990 added the sig/planner SIG: Planner label May 26, 2021
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label May 26, 2021
@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • qw4990
  • rebelice

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by writing /lgtm in a comment.
Reviewer can cancel approval by writing /lgtm cancel in a comment.

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels May 26, 2021
@qw4990
Copy link
Contributor

qw4990 commented May 26, 2021

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 56f126c

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label May 26, 2021
@ti-chi-bot ti-chi-bot merged commit 95e9ea8 into pingcap:master May 26, 2021
@wshwsh12
Copy link
Contributor

/run-cherry-picker

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request May 31, 2021
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-5.0 in PR #25000

@mjonss mjonss deleted the issue-24746 branch June 1, 2021 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-5.0 sig/execution SIG execution sig/planner SIG: Planner size/M Denotes a PR that changes 30-99 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Specify non-matching partition insert record fail expectly,but successful
6 participants