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

syncer: remove auto_random when track table from downstream #1823

Merged
merged 10 commits into from
Jul 7, 2021

Conversation

lance6716
Copy link
Collaborator

What problem does this PR solve?

close #1715

What is changed and how it works?

as title

Check List

Tests

  • Unit test

Code changes

Side effects

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 Jun 29, 2021
@lance6716 lance6716 added this to the v2.0.5 milestone Jun 29, 2021
@@ -684,6 +684,19 @@ func (s *Syncer) trackTableInfoFromDownstream(tctx *tcontext.Context, origSchema
createStmt.Table.Schema = model.NewCIStr(origSchema)
createStmt.Table.Name = model.NewCIStr(origTable)

// schema tracker sets non-clustered index, so can't handle auto_random.
Copy link
Contributor

Choose a reason for hiding this comment

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

Although we have turned tidb_enable_clustered_index off in defaultGlobalVars, the user can turn it back on via the configuration file, is there a problem if we hard delete the ColumnOptionAutoRandom there?

Copy link
Collaborator Author

@lance6716 lance6716 Jul 1, 2021

Choose a reason for hiding this comment

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

the schema tracker is mainly used to

  1. get column names because they are not written in binlog row events.
  2. calculate if two row changing can be sent concurrently by PK/UK
  3. calculate information of optimistic shard DDL

(don't know if I forget something, cc @GMHDBJD )

I think there's no harm to delete ColumnOptionAutoRandom, but agree we'd better reduce the modification. Will fix later

syncer/syncer.go Outdated Show resolved Hide resolved
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.

rest LGTM

@ti-chi-bot ti-chi-bot added size/L and removed size/M labels Jul 2, 2021
@GMHDBJD
Copy link
Collaborator

GMHDBJD commented Jul 5, 2021

Maybe we can add integration test for auto_random like auto_increment in downstream_more_column

@lance6716
Copy link
Collaborator Author

Maybe we can add integration test for auto_random like auto_increment in downstream_more_column

now the downstream in CI is TiDB v5, so SHOW CREATE TABLE will attach CLUSTERED INDEX column comment, which will not trigger this problem.

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

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 the status/LGT1 One reviewer already commented LGTM label Jul 5, 2021
@Ehco1996
Copy link
Contributor

Ehco1996 commented Jul 7, 2021

@lance6716 need fix conflicts

@Ehco1996
Copy link
Contributor

Ehco1996 commented Jul 7, 2021

/merge

@ti-chi-bot
Copy link
Member

@Ehco1996: /merge is only allowed for the committers, you can assign this pull request to the committer in list by filling /assign @committer in the comment to help merge this pull request.

In response to this:

/merge

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@lance6716 lance6716 added the require-LGT1 for small PR, LGT1 is enough label Jul 7, 2021
@lance6716
Copy link
Collaborator Author

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: dd06877

@ti-chi-bot
Copy link
Member

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

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-release-note This PR should be added into release notes. Remove this label once the release notes are updated require-LGT1 for small PR, LGT1 is enough size/L status/can-merge status/LGT1 One reviewer already commented LGTM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ddl:8216]Invalid auto random: column uuid is not the integer primary key, or the primary key is nonclustered
4 participants