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/tables: fix load partition when upgrade from an old TiDB #17971

Merged
merged 5 commits into from
Jun 12, 2020

Conversation

tiancaiamao
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #17952

Problem Summary:

In the old version TiDB, partition definition store the less than XXX as raw expression.
It should be integer, the new version TiDB assert XXX is an integer.

What is changed and how it works?

What's Changed:

Add some code to handle compatibility.

How it Works:

If the less than expression is not an integer, try to parser it as expression and calculate the integer.

Related changes

  • Need to cherry-pick to the release branch

Check List

Tests

  • Manual test (add detailed scripts or steps below)

I have manually test the binary with issue #17952 and it works.

Side effects

Ugly code

Release note

  • Fix a compatibility bug that partition table created in old version TiDB can not be loaded in 4.0, this bug makes the server fail to start.

@tiancaiamao
Copy link
Contributor Author

PTAL @crazycs520 @jackysp

@codecov
Copy link

codecov bot commented Jun 11, 2020

Codecov Report

Merging #17971 into master will increase coverage by 0.2059%.
The diff coverage is n/a.

@@               Coverage Diff                @@
##             master     #17971        +/-   ##
================================================
+ Coverage   79.4729%   79.6788%   +0.2059%     
================================================
  Files           524        524                
  Lines        142110     142802       +692     
================================================
+ Hits         112939     113783       +844     
+ Misses        20043      19919       -124     
+ Partials       9128       9100        -28     

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

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

if err != nil {
return 0, false
}
ret, isNull, err := tmp.EvalInt(sctx, chunk.Row{})

This comment was marked as resolved.

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

Copy link

@imtbkcat imtbkcat left a comment

Choose a reason for hiding this comment

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

LGTM

@tiancaiamao
Copy link
Contributor Author

/run-all-tests

@tiancaiamao
Copy link
Contributor Author

/run-all-tests

@tiancaiamao
Copy link
Contributor Author

/run-integration-common-test

@tiancaiamao tiancaiamao merged commit 1dc57ed into pingcap:master Jun 12, 2020
@tiancaiamao tiancaiamao deleted the partition-definition branch June 12, 2020 07:12
sre-bot pushed a commit to sre-bot/tidb that referenced this pull request Jun 12, 2020
Signed-off-by: sre-bot <sre-bot@pingcap.com>
@sre-bot
Copy link
Contributor

sre-bot commented Jun 12, 2020

cherry pick to release-4.0 in PR #17983

tiancaiamao added a commit that referenced this pull request Jun 15, 2020
#17983

Signed-off-by: sre-bot <sre-bot@pingcap.com>
Co-authored-by: tiancaiamao <tiancaiamao@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

making tidb upgrade from v3.0.5(tidb-ansible deploy it) to v4.0.0(tiup upgrade) but tidb don't running well
6 participants