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

serssion, server: fix the correctness of the query field in the DDL job #15435

Merged
merged 4 commits into from
Mar 18, 2020

Conversation

zimulala
Copy link
Contributor

@zimulala zimulala commented Mar 17, 2020

What problem does this PR solve?

Problem Summary:

	_, err = tk.Se.Execute(context.Background(), "show create table t")
	id, _, _, err := tk.Se.PrepareStmt("CREATE TABLE t2(id bigint PRIMARY KEY, age int)")
	...

	// Before this PR, this DDL job's Query is "show create table t".
	// After this PR,  this DDL job's Query is "CREATE TABLE t2(id bigint PRIMARY KEY, age int)".
	_, err = tk.Se.ExecutePreparedStmt(context.Background(), id, params)

If the DDL job's Query field is wrong, the binlog content will be wrong. We don't set the value of sessionctx.QueryString in ExecutePreparedStmt.

What is changed and how it works?

What's Changed: ExecutePreparedStmt will also be set to the value of sessionctx.QueryString.

Check List

Tests

  • Unit test

Release note

Fix the correctness of the query field in the DDL job

@zimulala zimulala added type/bugfix This PR fixes a bug. needs-cherry-pick-3.0 sig/sql-infra SIG: SQL Infra labels Mar 17, 2020
@zimulala
Copy link
Contributor Author

PTAL @wjhuang2016 @AilinKid @coocood

Copy link
Contributor

@AilinKid AilinKid left a comment

Choose a reason for hiding this comment

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

Rest LGTM

session/tidb.go Show resolved Hide resolved
Copy link
Member

@wjhuang2016 wjhuang2016 left a comment

Choose a reason for hiding this comment

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

LGTM

@zimulala zimulala added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 18, 2020
Copy link
Contributor

@AilinKid AilinKid left a comment

Choose a reason for hiding this comment

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

LGTM

@AilinKid AilinKid added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Mar 18, 2020
@codecov
Copy link

codecov bot commented Mar 18, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@4997bf2). Click here to learn what that means.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             master     #15435   +/-   ##
===========================================
  Coverage          ?   80.4808%           
===========================================
  Files             ?        502           
  Lines             ?     134606           
  Branches          ?          0           
===========================================
  Hits              ?     108332           
  Misses            ?      17813           
  Partials          ?       8461

@zimulala zimulala added the status/can-merge Indicates a PR has been approved by a committer. label Mar 18, 2020
@sre-bot
Copy link
Contributor

sre-bot commented Mar 18, 2020

Your auto merge job has been accepted, waiting for 15415

@sre-bot
Copy link
Contributor

sre-bot commented Mar 18, 2020

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Mar 18, 2020

cherry pick to release-3.0 in PR #15443

@sre-bot
Copy link
Contributor

sre-bot commented Mar 18, 2020

cherry pick to release-3.1 in PR #15444

@you06 you06 added this to the v4.0.0-rc milestone Mar 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/sql-infra SIG: SQL Infra status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants