Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

*: read downstream table before CREATE TABLE to fix IF NOT EXISTS #1915

Merged
merged 7 commits into from
Jul 26, 2021

Conversation

lance6716
Copy link
Collaborator

What problem does this PR solve?

revert some of #1699

What is changed and how it works?

as title, we read downstream table from checkpoint/etcd/SHOW CREATE TABLE first, to deal with IF NOT EXISTS.

in future we'll change to a better strategy.

Check List

Tests

  • pass original tests

Code changes

Side effects

  • Breaking backward compatibility

Related changes

  • Need to cherry-pick to the release branch
  • Need to be included in the release note

@lance6716 lance6716 added needs-cherry-pick-release-2.0 This PR should be cherry-picked to release-2.0. Remove this label after cherry-picked to release-2.0 needs-update-release-note This PR should be added into release notes. Remove this label once the release notes are updated labels Jul 26, 2021
@lance6716 lance6716 added this to the v2.0.5 milestone Jul 26, 2021
@@ -252,11 +252,11 @@ function DM_027_CASE() {
run_sql_source1 "insert into ${shardddl1}.${tb2} values (4)"
run_sql_source1 "insert into ${shardddl1}.${tb3} values (5,6)"
# we now haven't checked table struct when create sharding table
# there should be a error message like "Unknown column 'val' in 'field list'", "unknown column val"
# but different TiDB version output different message. so we only roughly match here
# and we'll attach IF NOT EXISTS to every CREATE TABLE and fetch downstream table first, so downstream table strcuture
Copy link
Collaborator Author

@lance6716 lance6716 Jul 26, 2021

Choose a reason for hiding this comment

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

this will cause CREATE TABLE in upstream becomes ineffective when downstream has already contained that table

When downstream table has same column with upstream one, this PR imtroduced more correctness for genearting WHERE
When downstream table has less column, this PR changes error message from "unknown column" to "column value mismatch"
When downstream table has more column, this PR will break the synchronizing with error "Column count doesn't match value count"

@lance6716
Copy link
Collaborator Author

/run-all-tests

@ti-chi-bot ti-chi-bot added size/M and removed size/S labels Jul 26, 2021
@lance6716 lance6716 added the needs-update-docs Should update docs after this PR is merged. Remove this label once the docs are updated label Jul 26, 2021
@ti-chi-bot ti-chi-bot added the status/LGT1 One reviewer already commented LGTM label Jul 26, 2021
Copy link
Collaborator

@GMHDBJD GMHDBJD 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-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • GMHDBJD
  • glorv

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added status/LGT2 Two reviewers already commented LGTM, ready for merge and removed status/LGT1 One reviewer already commented LGTM labels Jul 26, 2021
@glorv
Copy link
Collaborator

glorv commented Jul 26, 2021

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: dcae369

Copy link
Contributor

@Ehco1996 Ehco1996 left a comment

Choose a reason for hiding this comment

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

LGTM

@glorv
Copy link
Collaborator

glorv commented Jul 26, 2021

/merge

@ti-chi-bot ti-chi-bot merged commit 04ca3a4 into pingcap:master Jul 26, 2021
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #1919.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs-cherry-pick-release-2.0 This PR should be cherry-picked to release-2.0. Remove this label after cherry-picked to release-2.0 needs-update-docs Should update docs after this PR is merged. Remove this label once the docs are updated needs-update-release-note This PR should be added into release notes. Remove this label once the release notes are updated size/M status/can-merge status/LGT2 Two reviewers already commented LGTM, ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants