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 an invalid default value cause bootstrap failed #4916

Merged
merged 12 commits into from
May 27, 2022

Conversation

Lloyd-Pottiger
Copy link
Contributor

@Lloyd-Pottiger Lloyd-Pottiger commented May 18, 2022

What problem does this PR solve?

Issue Number: close #3157

Problem Summary:

What is changed and how it works?

when value is 0.0, value.convert<Int64>(); raise a error.
Convert it to String first, and convert String to Int64 by std::stoull
static_cast<Int64>(std::stoull(value.convert<String>()));

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

None

Signed-off-by: Lloyd-Pottiger <yan1579196623@gmail.com>
Signed-off-by: Lloyd-Pottiger <yan1579196623@gmail.com>
Signed-off-by: Lloyd-Pottiger <yan1579196623@gmail.com>
@ti-chi-bot
Copy link
Member

ti-chi-bot commented May 18, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • JaySon-Huang
  • flowbehappy

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 needs-cherry-pick-release-6.0 Type: Need cherry pick to release-6.0 release-note-none Denotes a PR that doesn't merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels May 18, 2022
@Lloyd-Pottiger
Copy link
Contributor Author

mysql test> create table t (a int);
-- The type of column i is int, but the default value is set to "0.00"
mysql test> alter table t add column i int not null default 0.00; 
mysql test> alter tablet t set tiflash replica 1;
mysql test> select a from t;

@ti-chi-bot ti-chi-bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels May 18, 2022
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label May 27, 2022
Signed-off-by: Lloyd-Pottiger <yan1579196623@gmail.com>
@ti-chi-bot ti-chi-bot added the needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. label May 27, 2022
Signed-off-by: Lloyd-Pottiger <yan1579196623@gmail.com>
Signed-off-by: Lloyd-Pottiger <yan1579196623@gmail.com>
@Lloyd-Pottiger
Copy link
Contributor Author

mysql> use test
Database changed
mysql> create table t (a int default 0.0);
Query OK, 0 rows affected (0.07 sec)

mysql> ALTER TABLE t SET TIFLASH REPLICA 1;
Query OK, 0 rows affected (0.07 sec)

mysql> show create table t;
+-------+------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                               |
+-------+------------------------------------------------------------------------------------------------------------+
| t     | CREATE TABLE `t` (
  `a` int(11) DEFAULT '0.0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin |
+-------+------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> insert t (a) values(default);
Query OK, 1 row affected (0.01 sec)

mysql> select a from t;
+------+
| a    |
+------+
|    0 |
+------+
1 row in set (0.25 sec)

mysql> alter table t change a a int default 1.25;
Query OK, 0 rows affected (0.06 sec)

mysql> insert t (a) values(default);
Query OK, 1 row affected (0.00 sec)

mysql> select a from t;
+------+
| a    |
+------+
|    0 |
|    1 |
+------+
2 rows in set (0.02 sec)

mysql> alter table t change a a int default 2.8;
Query OK, 0 rows affected (0.06 sec)

mysql> insert t (a) values(default);
Query OK, 1 row affected (0.01 sec)

mysql> select a from t;
+------+
| a    |
+------+
|    0 |
|    1 |
|    3 |
+------+
3 rows in set (0.02 sec)

@Lloyd-Pottiger
Copy link
Contributor Author

/run-all-tests

@Lloyd-Pottiger
Copy link
Contributor Author

/rebuild

@sre-bot
Copy link
Collaborator

sre-bot commented May 27, 2022

Coverage for changed files

Filename                                                                                              Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/home/jenkins/agent/workspace/tiflash-build-common/tiflash/dbms/src/Storages/Transaction/TiDB.cpp         480               266    44.58%          45                13    71.11%         853               394    53.81%         334               148    55.69%
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                                                                     480               266    44.58%          45                13    71.11%         853               394    53.81%         334               148    55.69%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
18154      9788             46.08%    202642  97933        51.67%

full coverage report (for internal network access only)

Copy link
Contributor

@JaySon-Huang JaySon-Huang 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 ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels May 27, 2022
@Lloyd-Pottiger
Copy link
Contributor Author

/merge

@sre-bot
Copy link
Collaborator

sre-bot commented May 27, 2022

Coverage for changed files

Filename                                                                                              Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/home/jenkins/agent/workspace/tiflash-build-common/tiflash/dbms/src/Storages/Transaction/TiDB.cpp         480               266    44.58%          45                13    71.11%         853               394    53.81%         334               148    55.69%
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                                                                     480               266    44.58%          45                13    71.11%         853               394    53.81%         334               148    55.69%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
18277      9785             46.46%    204804  98125        52.09%

full coverage report (for internal network access only)

@ti-chi-bot ti-chi-bot merged commit ca3e1c6 into pingcap:master May 27, 2022
@ti-chi-bot
Copy link
Member

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

@ti-chi-bot
Copy link
Member

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

@Lloyd-Pottiger Lloyd-Pottiger deleted the fix-invalid-default-value branch May 27, 2022 11:36
@JaySon-Huang JaySon-Huang added needs-cherry-pick-release-5.0 PR which needs to be cherry-picked to release-5.0 needs-cherry-pick-release-5.1 PR which needs to be cherry-picked to release-5.1 needs-cherry-pick-release-5.2 PR which needs to be cherry-picked to release-5.2 needs-cherry-pick-release-5.3 Type: Need cherry pick to release-5.3 needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. labels Jul 11, 2022
ti-chi-bot pushed a commit to ti-chi-bot/tiflash that referenced this pull request Jul 11, 2022
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

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

@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tiflash that referenced this pull request Jul 11, 2022
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tiflash that referenced this pull request Jul 11, 2022
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tiflash that referenced this pull request Jul 11, 2022
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-5.0 PR which needs to be cherry-picked to release-5.0 needs-cherry-pick-release-5.1 PR which needs to be cherry-picked to release-5.1 needs-cherry-pick-release-5.2 PR which needs to be cherry-picked to release-5.2 needs-cherry-pick-release-5.3 Type: Need cherry pick to release-5.3 needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. needs-cherry-pick-release-6.0 Type: Need cherry pick to release-6.0 needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bootstrap failed because of an invalid default value to the corresponding type
6 participants