mariadb/storage
Alexander Barkov 9edb1a5ce3 MDEV-30483 After upgrade to 10.6 from Mysql 5.7 seeing "InnoDB: Column last_update in table mysql.innodb_table_stats is BINARY(4) NOT NULL but should be INT UNSIGNED NOT NULL"
Problem:

Field_timestampf implementations differ in MySQL and MariaDB:
- MariaDB sets the UNSIGNED_FLAG in Field::flags
- MySQL does not

The reference table structures
(defined in table_stats_schema and index_stats_schema)
expected the last_update column to have the DATA_UNSIGNED flag,
because MariaDB's Field_timestampf has the UNSIGNED_FLAG.
It worked fine on pure MariaDB installations.

However, if a MariaDB server starts over a MySQL-5.7 data directory during
a migration, the last_update column does not have DATA_UNSIGNED flag,
because MySQL's Field_timestampf does not have the UNSIGNED_FLAG.

This made InnoDB (after the migration from MySQL) complain into the server
error log about the unexpected data type.

The actual fix is done in storage/innobase/dict/dict0stats.cc:
It removes DATA_UNSIGNED from the prtype_mask member of the reference columns,
so now it does not require the underlying columns to have this flag.

The rest of the fix is needed for MTR tests.
The new data type plugin TYPE_MYSQL_TIMESTAMP implements a slightly modified
version of Field_timestampf, which removes the unsigned flag, so
it works like MySQL's Field_timestampf.

The MTR test ALTERs the data type of the columns
table_stats_schema.last_update and index_stats_schema.last_update
from TIMESTAMP to TYPE_MYSQL_TIMESTAMP, then makes InnoDB
verify the structure of the two statistics tables by creating
and populating an InnoDB table t1.

Without the fix made storage/innobase/dict/dict0stats.cc,
MTR complains about unexpected warnings in the server error log:

[ERROR] InnoDB: Column last_update in table mysql.innodb_table_stats is ...
[ERROR] InnoDB: Column last_update in table mysql.innodb_index_stats is ...

With the fix made storage/innobase/dict/dict0stats.cc these warnings
go away.
2023-05-25 05:25:39 +04:00
..
archive Merge 10.4 into 10.5 2023-02-10 12:02:11 +02:00
blackhole Merge 10.4 into 10.5 2023-02-10 12:02:11 +02:00
columnstore Merge branch '10.5' into 10.6 2023-01-31 09:31:42 +01:00
connect Merge 10.5 into 10.6 2023-04-25 13:10:33 +03:00
csv Merge branch 'bb-10.4-release' into bb-10.5-release 2021-02-15 16:43:15 +01:00
example Merge 10.4 into 10.5 2023-02-10 12:02:11 +02:00
federated Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
federatedx Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
heap Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
innobase MDEV-30483 After upgrade to 10.6 from Mysql 5.7 seeing "InnoDB: Column last_update in table mysql.innodb_table_stats is BINARY(4) NOT NULL but should be INT UNSIGNED NOT NULL" 2023-05-25 05:25:39 +04:00
maria Merge 10.5 into 10.6 2023-04-11 16:15:19 +03:00
mroonga Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
myisam Merge 10.5 into 10.6 2023-05-23 12:25:39 +03:00
myisammrg Merge 10.5 into 10.6 2023-05-23 12:25:39 +03:00
oqgraph Merge 10.5 into 10.6 2022-01-18 12:59:50 +02:00
perfschema Merge branch '10.5' into 10.6 2023-05-03 09:51:25 +02:00
rocksdb Merge branch '10.5' into 10.6 2023-05-04 18:47:11 +02:00
sequence Merge 10.4 into 10.5 2023-02-10 12:02:11 +02:00
sphinx Merge branch '10.5' into 10.6 2022-11-02 14:33:20 +01:00
spider Merge 10.5 into 10.6 2023-05-23 12:25:39 +03:00
test_sql_discovery Merge 10.5 into 10.6 2022-09-20 16:53:20 +03:00