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

bindinfo: physically delete previous binding when recreating a binding #21349

Merged
merged 6 commits into from
Dec 3, 2020

Conversation

eurekaka
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #21288

Problem Summary:

Unexpected binding cache if there are concurrent CREATE BINDING on multiple tidb instances.

What is changed and how it works?

What's Changed:

Physically delete previous bindings when recreating a binding, instead of marking them as deleted.

How it Works:

Logical delete may cause unexpected binding caches if there are concurrent CREATE BINDING on multiple tidb instances, because the record with using status is not guaranteed to have larger update_time than those records with deleted status.

Since recreation would always insert a new binding with same fingerprint, this recreation can be synchronized to other tidb instances successfully.

Related changes

  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test
  • Manual test: use the reproduction program provided in the issue, the binding cache is correct after applying this PR.

Side effects

N/A

Release note

  • physically delete previous binding when recreating a binding

Copy link
Contributor

@Reminiscent Reminiscent 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-srebot
Copy link
Contributor

@Reminiscent, Thanks for your review. The bot only counts LGTMs from Reviewers and higher roles, but you're still welcome to leave your comments. See the corresponding SIG page for more information. Related SIG: planner(slack).

@eurekaka eurekaka added the status/LGT1 Indicates that a PR has LGTM 1. label Dec 1, 2020
qw4990
qw4990 previously approved these changes Dec 1, 2020
Copy link
Contributor

@qw4990 qw4990 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
Contributor

@qw4990 qw4990 left a comment

Choose a reason for hiding this comment

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

LGTM

@qw4990
Copy link
Contributor

qw4990 commented Dec 1, 2020

/merge

@ti-srebot
Copy link
Contributor

@qw4990 Oops! This PR requires at least 2 LGTMs to merge. The current number of LGTM is 1

@qw4990
Copy link
Contributor

qw4990 commented Dec 1, 2020

PTAL @lzmhhh123

@eurekaka
Copy link
Contributor Author

eurekaka commented Dec 3, 2020

/run-all-tests

@eurekaka
Copy link
Contributor Author

eurekaka commented Dec 3, 2020

/run-all-tests

@eurekaka eurekaka merged commit 3b86426 into pingcap:master Dec 3, 2020
@eurekaka eurekaka deleted the concurrent_create branch December 3, 2020 07:12
ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Dec 3, 2020
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 in PR #21466

eurekaka added a commit that referenced this pull request Dec 23, 2020
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>

Co-authored-by: Kenan Yao <cauchy1992@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epic/sql-plan-management sig/planner SIG: Planner status/LGT1 Indicates that a PR has LGTM 1. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SPM: unexpected behavior in parallel creation of global binding
4 participants