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

*: fix updating the column value when the column is dropping and in WriteOnly state #15539

Merged
merged 7 commits into from
Mar 23, 2020

Conversation

zimulala
Copy link
Contributor

@zimulala zimulala commented Mar 20, 2020

What problem does this PR solve?

Issue Number: close #15386

create table t (a int, b int)
insert into t values(1,1);

Do the following:

time connection1 connection2
t1 drop column
t2 column state (write only) update t set a =5 ,b=2
t3 column state (write only) update t set a=10 where b=2
t4 column state (none) select * from t

The result:

tidb> select * from t;
+------+
| a |
+------+
| 5 |
+------+
1 row in set (0.00 sec)

Problem Summary:
When the column is dropping and in WriteOnly state, the value of this column cannot be explicitly updated.

What is changed and how it works?

What's Changed:
When the column is in a falling state and in WriteOnly state, if we update this column value explicitly, an error will be returned.

Related changes

  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test

Side effects

  • Performance regression
    • Consumes more CPU
    • Consumes more MEM
  • Breaking backward compatibility

Release note

@zimulala zimulala added type/bugfix This PR fixes a bug. require-LGT3 Indicates that the PR requires three LGTM. sig/sql-infra SIG: SQL Infra labels Mar 20, 2020
@zimulala zimulala requested review from a team as code owners March 20, 2020 16:14
@ghost ghost requested review from eurekaka, lzmhhh123, qw4990, XuHuaiyu and a team and removed request for a team March 20, 2020 16:14
@github-actions github-actions bot added the sig/execution SIG execution label Mar 20, 2020
@zimulala
Copy link
Contributor Author

PTAL @bb7133 @winoros @crazycs520

@codecov
Copy link

codecov bot commented Mar 23, 2020

Codecov Report

Merging #15539 into master will not change coverage by %.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             master     #15539   +/-   ##
===========================================
  Coverage   80.5019%   80.5019%           
===========================================
  Files           502        502           
  Lines        134644     134644           
===========================================
  Hits         108391     108391           
  Misses        17776      17776           
  Partials       8477       8477           

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

executor/update.go Outdated Show resolved Hide resolved
Copy link
Contributor

@crazycs520 crazycs520 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 23, 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

@zimulala
Copy link
Contributor Author

/run-unit-test

@zimulala zimulala removed the status/LGT1 Indicates that a PR has LGTM 1. label Mar 23, 2020
@tangenta tangenta added status/LGT3 The PR has already had 3 LGTM. status/can-merge Indicates a PR has been approved by a committer. and removed status/LGT2 Indicates that a PR has LGTM 2. labels Mar 23, 2020
@sre-bot
Copy link
Contributor

sre-bot commented Mar 23, 2020

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Mar 23, 2020

@zimulala merge failed.

@AilinKid
Copy link
Contributor

/merge

@sre-bot
Copy link
Contributor

sre-bot commented Mar 23, 2020

Your auto merge job has been accepted, waiting for 15544

@sre-bot
Copy link
Contributor

sre-bot commented Mar 23, 2020

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Mar 23, 2020

@zimulala merge failed.

@AilinKid
Copy link
Contributor

/merge

@sre-bot
Copy link
Contributor

sre-bot commented Mar 23, 2020

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Mar 23, 2020

@zimulala merge failed.

@AilinKid
Copy link
Contributor

/merge

@sre-bot
Copy link
Contributor

sre-bot commented Mar 23, 2020

/run-all-tests

@sre-bot sre-bot merged commit b1ccb30 into pingcap:master Mar 23, 2020
sre-bot pushed a commit to sre-bot/tidb that referenced this pull request Mar 23, 2020
Signed-off-by: sre-bot <sre-bot@pingcap.com>
@sre-bot
Copy link
Contributor

sre-bot commented Mar 23, 2020

cherry pick to release-3.0 in PR #15576

sre-bot pushed a commit to sre-bot/tidb that referenced this pull request Mar 23, 2020
Signed-off-by: sre-bot <sre-bot@pingcap.com>
@sre-bot
Copy link
Contributor

sre-bot commented Mar 23, 2020

cherry pick to release-3.1 in PR #15577

@@ -3226,9 +3226,42 @@ func (b *PlanBuilder) buildUpdate(ctx context.Context, update *ast.UpdateStmt) (
tblID2table[id], _ = b.is.TableByID(id)
}
updt.TblColPosInfos, err = buildColumns2Handle(updt.OutputNames(), tblID2Handle, tblID2table, true)
if err == nil {
err = checkUpdateList(b.ctx, tblID2table, updt)
Copy link
Contributor

@lysu lysu Mar 24, 2021

Choose a reason for hiding this comment

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

it seems we only check it in updateExec above normal executor..so updateExec above point-get maybe hit this bug? 😭

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lysu mmm... Then I should fix this or you should fix it?

Copy link
Contributor

Choose a reason for hiding this comment

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

let me see see- -

I'd fixed in #23491 during a refactor, but maybe it's not suitable to cherry-pick to 4.0 or 3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
require-LGT3 Indicates that the PR requires three LGTM. sig/execution SIG execution sig/sql-infra SIG: SQL Infra status/can-merge Indicates a PR has been approved by a committer. status/LGT3 The PR has already had 3 LGTM. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

unexpected result when executing DDL and DML concurrently
7 participants