[MDEV-18042] Server crashes in mysql_alter_table upon adding a non-null date column under NO_ZERO_DATE with ALGORITHM=INPLACE Created: 2018-12-20 Updated: 2020-07-31 Resolved: 2020-07-31 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Alter Table, Temporal Types |
| Affects Version/s: | 10.5.3, 10.2, 10.3, 10.4 |
| Fix Version/s: | 10.2.33, 10.3.24, 10.4.14, 10.5.5 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Elena Stepanova | Assignee: | Nikita Malyavin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | affects-tests, not-10.1 | ||
| Issue Links: |
|
||||||||||||
| Description |
|
Reproducible with at least MyISAM and Aria. All of debug, non-debug and ASAN builds are affected. |
| Comments |
| Comment by Alexander Barkov [ 2019-03-21 ] | ||||||||||||||||||||||||||||||||||||||
|
The problem happens because of a NULL pointer:
If I remove the ALGORIGHTM=INPLACE part, the query works fine, and the crash line with make_truncated_value_warning is never reached:
If I additionally insert one record, the query correctly returns with an error, and new_table is a non-null pointer on the line with make_truncated_value_warning:
| ||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2019-03-30 ] | ||||||||||||||||||||||||||||||||||||||
|
Here is a test case for InnoDB. I don't know whether it's the same, as INPLACE doesn't play a role here, but it's impossible to distinguish by the stack trace, so I'm adding it here.
or
| ||||||||||||||||||||||||||||||||||||||
| Comment by Alice Sherepa [ 2019-04-30 ] | ||||||||||||||||||||||||||||||||||||||
|
reproducible also with ALGORITHM=NOCOPY or ALGORITHM=INSTANT | ||||||||||||||||||||||||||||||||||||||
| Comment by Alice Sherepa [ 2019-08-01 ] | ||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||
| Comment by Roel Van de Paar [ 2020-04-28 ] | ||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2020-07-10 ] | ||||||||||||||||||||||||||||||||||||||
|
In error reporting some how supposed to be used "new table" which shoud not be created in case of INPLACE alter, so I have no idea how it shoud work. | ||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2020-07-10 ] | ||||||||||||||||||||||||||||||||||||||
|
IMHO it is incorrect error handling, the error does not connected with a field | ||||||||||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2020-07-29 ] | ||||||||||||||||||||||||||||||||||||||
|
This patch looks generally OK for me: I have only some minor suggestions:
Please add an overloaded function so one can use:
2. Please add all reported test cases from this MDEV. | ||||||||||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2020-07-29 ] | ||||||||||||||||||||||||||||||||||||||
|
As discussed on Slack, make_truncated_value_warning() is already overloaded in 10.2. So no need to add 2 more overloads. Ok to pass 3 NULLs. | ||||||||||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2020-07-29 ] | ||||||||||||||||||||||||||||||||||||||
|
Ok to push after adding all tests from this MDEV. Don't forget to remove the not-needed #include <table.h> from sql_time.h. | ||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2020-07-31 ] | ||||||||||||||||||||||||||||||||||||||
|
In the merge from 10.3 to 10.4 I had to refactor Temporal::Warn_push warn() and THD::push_warning_truncated_priv() and many other functions accordingly. For merging to 10.5, there are even more conflicts to be resolved. It would have been much better if a separate patch for 10.4 and 10.5 had been pushed for test and review before anything was pushed to 10.2. Merges are not reviewed. |