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

Bulk update integer display width #19393

Merged
merged 4 commits into from
Dec 2, 2024

Conversation

dveeden
Copy link
Contributor

@dveeden dveeden commented Nov 13, 2024

What is changed, added or deleted? (Required)

Related to:

What this does is basically the following, with some manual changes:

git grep -il '[^a-z]int([0-9]*)' | grep -vE '^(information-schema|releases)' | xargs sed -i 's/[^a-z]int([0-9]*)/ int/gi'
git grep -il '[^a-z]tinyint([0-9]*)' | grep -vE '^(information-schema|releases)' | xargs sed -i 's/[^a-z]tinyint([0-9]*)/ tinyint/gi'
git grep -il '[^a-z]smallint([0-9]*)' | grep -vE '^(information-schema|releases)' | xargs sed -i 's/[^a-z]smallint([0-9]*)/ smallint/gi'
git grep -il '[^a-z]mediumint([0-9]*)' | grep -vE '^(information-schema|releases)' | xargs sed -i 's/[^a-z]mediumint([0-9]*)/ mediumint/gi'
git grep -il '[^a-z]bigint([0-9]*)' | grep -vE '^(information-schema|releases)' | xargs sed -i 's/[^a-z]bigint([0-9]*)/ bigint/gi'

Things to consider:

  • This should not affect releases/
  • We should be careful to not break formatting of table based output
  • We should be careful to not break examples that rely on display width
  • The display width may be visible in information_schema information. Also this has a lot of table based output that we should be careful not to break the formatting of.
  • Display width can still be in (older)MySQL and MariaDB output (for migration info etc)
  • tinyint(1) is a special case as it is an alias for bool (see data-type-numeric.md)
  • non-sql should not be replaced (e.g. decimal.NewFromInt(10000))
  • This should not affect tidb-cloud/

Which TiDB version(s) do your changes apply to? (Required)

Tips for choosing the affected version(s):

By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.

For details, see tips for choosing the affected versions.

  • master (the latest development version)
  • v8.5 (TiDB 8.5 versions)
  • v8.4 (TiDB 8.4 versions)
  • v8.3 (TiDB 8.3 versions)
  • v8.2 (TiDB 8.2 versions)
  • v8.1 (TiDB 8.1 versions)
  • v7.5 (TiDB 7.5 versions)
  • v7.1 (TiDB 7.1 versions)
  • v6.5 (TiDB 6.5 versions)
  • v6.1 (TiDB 6.1 versions)
  • v5.4 (TiDB 5.4 versions)
  • v5.3 (TiDB 5.3 versions)

What is the related PR or file link(s)?

  • This PR is translated from:
  • Other reference link(s):

Do your changes match any of the following descriptions?

  • Delete files
  • Change aliases
  • Need modification after applied to another branch
  • Might cause conflicts after applied to another branch

@dveeden dveeden requested review from hfxsd, Oreoxmt and qiancai November 13, 2024 12:25
Copy link

ti-chi-bot bot commented Nov 13, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. area/develop This PR relates to the area of TiDB App development. missing-translation-status This PR does not have translation status info. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Nov 13, 2024
@ti-chi-bot ti-chi-bot bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Nov 13, 2024
@dveeden dveeden requested review from mjonss and removed request for hfxsd November 13, 2024 12:39
@dveeden dveeden marked this pull request as ready for review November 13, 2024 12:39
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 13, 2024
Copy link
Contributor

@mjonss mjonss left a comment

Choose a reason for hiding this comment

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

Just some questions about origin of output, if MySQL/DM or TiDB Cloud/Serverless has the same output and/or version

@@ -124,7 +124,7 @@ binlog-schema list -s mysql-replica-01 task_single db_single t1
"sources": [
{
"result": true,
"msg": "CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`)) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin",
"msg": "CREATE TABLE `t1` ( `c1` int NOT NULL, `c2` int DEFAULT NULL, PRIMARY KEY (`c1`)) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin",
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is a MySQL Source, should it be updated or not? Is it generated by MySQL, TiDB or DM?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lance6716 Should we exclude dm/ for now or not?

Copy link
Contributor

Choose a reason for hiding this comment

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

dm will only save TableInfo and recover the SHOW CREATE TABLE statement using TiDB functions, so it should also be updated

@@ -1615,7 +1615,7 @@ curl -X 'GET' \
{
"schema_name": "db1",
"table_name": "table1",
"schema_create_sql": "CREATE TABLE `t1` (`id` int(11) NOT NULL AUTO_INCREMENT,PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin"
"schema_create_sql": "CREATE TABLE `t1` (`id` int NOT NULL AUTO_INCREMENT,PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin"
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, which is the source and where is it generated? MySQL, TiDB or DM?

@@ -1637,7 +1637,7 @@ curl -X 'PUT' \
-H 'accept: */*' \
-H 'Content-Type: application/json' \
-d '{
"sql_content": "CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` int(11) DEFAULT NULL, `c3` int(11) DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;",
Copy link
Contributor

Choose a reason for hiding this comment

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

Here it is input, so I guess it does not matter, and removing the display width should work regardless.

@@ -116,7 +116,7 @@ To extract the source information of upstream sharded tables to the merged table

```sql
CREATE TABLE `test`.`t` (
a int(11) PRIMARY KEY,
a int PRIMARY KEY,
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar here I assume MySQL is the upstream, but I have no issues with updating these as well (unless the output is still including the display width from MySQL or DM).

@@ -184,7 +184,7 @@ mysql> select * from test.t;
```sql
CREATE TABLE `test`.`t` (
c_table varchar(10) DEFAULT NULL,
a int(11) PRIMARY KEY,
a int PRIMARY KEY,
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, where does it origin from and will it be with or without display width?

@@ -331,7 +331,7 @@ The operation processes are:
"mode": "pessimistic"
"owner": "mysql-replica-02",
"DDLs": [
"USE `shard_db`; ALTER TABLE `shard_db`.`shard_table` ADD COLUMN `c2` int(11);"
"USE `shard_db`; ALTER TABLE `shard_db`.`shard_table` ADD COLUMN `c2` int;"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this generated by MySQL or DM? Will it use display width or not?

tidb-cloud/serverless-driver-kysely-example.md Outdated Show resolved Hide resolved
tidb-cloud/tidb-cloud-import-local-files.md Outdated Show resolved Hide resolved
Copy link

ti-chi-bot bot commented Nov 13, 2024

@mjonss: adding LGTM is restricted to approvers and reviewers in OWNERS files.

In response to this:

Just some questions about origin of output, if MySQL/DM or TiDB Cloud/Serverless has the same output and/or version

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 kubernetes/test-infra repository.

@dveeden dveeden requested a review from lance6716 November 13, 2024 19:47
@Oreoxmt Oreoxmt self-assigned this Nov 14, 2024
@Oreoxmt Oreoxmt added translation/doing This PR's assignee is translating this PR. for-release This PR relates to a TiDB release but does not have a tracked feature. v8.5 and removed missing-translation-status This PR does not have translation status info. labels Nov 14, 2024
@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Nov 14, 2024
basic-sql-operations.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@Oreoxmt Oreoxmt 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 bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Nov 19, 2024
@Oreoxmt Oreoxmt added translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR. and removed translation/doing This PR's assignee is translating this PR. labels Nov 19, 2024
@Oreoxmt
Copy link
Collaborator

Oreoxmt commented Nov 19, 2024

/hold

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 19, 2024
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Dec 2, 2024
Copy link

ti-chi-bot bot commented Dec 2, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-11-19 03:43:51.257957962 +0000 UTC m=+932593.448826961: ☑️ agreed by Oreoxmt.
  • 2024-12-02 02:55:07.226848232 +0000 UTC m=+1037094.846502747: ☑️ agreed by qiancai.

@Oreoxmt
Copy link
Collaborator

Oreoxmt commented Dec 2, 2024

/unhold

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 2, 2024
@Oreoxmt
Copy link
Collaborator

Oreoxmt commented Dec 2, 2024

/approve

Copy link

ti-chi-bot bot commented Dec 2, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Oreoxmt

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

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added the approved label Dec 2, 2024
@ti-chi-bot ti-chi-bot bot merged commit 22341b8 into pingcap:master Dec 2, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved area/develop This PR relates to the area of TiDB App development. for-release This PR relates to a TiDB release but does not have a tracked feature. lgtm size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR. v8.5
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants