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: avoid duplicate bindings caused by concurrent baseline capture (#22182) #22295

Merged
merged 2 commits into from
Jan 8, 2021

Conversation

ti-srebot
Copy link
Contributor

@ti-srebot ti-srebot commented Jan 8, 2021

cherry-pick #22182 to release-4.0
You can switch your code base to this Pull Request by using git-extras:

# In tidb repo:
git pr 22295

After apply modifications, you can push your change to this PR via:

git push git@github.com:ti-srebot/tidb.git pr/22295:ti-srebot:release-4.0-0a4ec0da2b80

What problem does this PR solve?

Issue Number: close #22178

Problem Summary:

Duplicate bindings for a same original_sql.

What is changed and how it works?

What's Changed:

Call CreateBindRecord instead of AddBindRecord in CaptureBaselines.

How it Works:

AddBindRecord only checks the duplicate in binding cache, while CreateBindRecord would remove duplicate bindings in mysql.bind_info unconditionally.

Related changes

  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test

Side effects
N/A

Release note

  • Avoid duplicate bindings caused by concurrent baseline capture

@ti-srebot
Copy link
Contributor Author

/run-all-tests

@ti-srebot
Copy link
Contributor Author

@eurekaka you're already a collaborator in bot's repo.

@@ -1761,6 +1761,54 @@ func (s *testSuite) TestDMLIndexHintBind(c *C) {
c.Assert(tk.MustUseIndex("delete from t where b = 1 and c > 1", "idx_c(c)"), IsTrue)
}

<<<<<<< HEAD
Copy link
Contributor

Choose a reason for hiding this comment

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

PTAL @eurekaka

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 ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Jan 8, 2021
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
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

@ti-srebot ti-srebot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jan 8, 2021
@qw4990
Copy link
Contributor

qw4990 commented Jan 8, 2021

/run-all-tests

@eurekaka eurekaka merged commit 83603c8 into pingcap:release-4.0 Jan 8, 2021
@eurekaka eurekaka deleted the release-4.0-0a4ec0da2b80 branch January 8, 2021 07:03
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/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug. type/4.0-cherry-pick
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants