mariadb/sql
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
..
share Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
add_errmsg
authors.h
backup.cc
backup.h
bounded_queue.h
client_settings.h
CMakeLists.txt
compat56.cc
compat56.h
contributors.h
create_options.cc
create_options.h
create_tmp_table.h
custom_conf.h
datadict.cc
datadict.h
ddl_log.cc
ddl_log.h
debug.cc
debug.h
debug_sync.cc Merge 10.5 into 10.6 2023-04-11 16:15:19 +03:00
debug_sync.h
derived_handler.cc
derived_handler.h
derror.cc
derror.h
des_key_file.cc
des_key_file.h
discover.cc
discover.h
encryption.cc
event_data_objects.cc Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
event_data_objects.h
event_db_repository.cc
event_db_repository.h
event_parse_data.cc
event_parse_data.h
event_queue.cc
event_queue.h
event_scheduler.cc
event_scheduler.h
events.cc
events.h
field.cc MDEV-31199: Assertion `field->table->stats_is_read' fails with hash_join_cardinality=on 2023-05-05 13:55:42 +03:00
field.h 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
field_comp.cc
field_comp.h
field_conv.cc
filesort.cc Merge 10.5 into 10.6 2023-04-11 16:15:19 +03:00
filesort.h
filesort_utils.cc
filesort_utils.h
gcalc_slicescan.cc
gcalc_slicescan.h
gcalc_tools.cc
gcalc_tools.h
gen_lex_hash.cc
gen_lex_token.cc
gen_win_tzname_data.ps1
gen_yy_files.cmake
grant.cc
grant.h
group_by_handler.cc
group_by_handler.h
gstream.cc
gstream.h
ha_partition.cc
ha_partition.h Merge 10.5 into 10.6 2023-04-11 16:15:19 +03:00
ha_sequence.cc Merge branch 'bb-10.4-release' into bb-10.5-release 2023-05-02 13:54:54 +02:00
ha_sequence.h
handle_connections_win.cc
handle_connections_win.h
handler.cc Merge 10.5 into 10.6 2023-05-22 08:38:21 +03:00
handler.h MDEV-29293 MariaDB stuck on starting commit state 2023-05-22 00:42:05 +02:00
hash_filo.cc
hash_filo.h
hostname.cc Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
hostname.h
init.cc
init.h
innodb_priv.h
item.cc Merge branch '10.5' into 10.6 2023-05-03 09:51:25 +02:00
item.h Merge branch '10.5' into 10.6 2023-05-03 09:51:25 +02:00
item_buff.cc
item_cmpfunc.cc Merge branch '10.5' into 10.6 2023-05-03 09:51:25 +02:00
item_cmpfunc.h Merge branch '10.5' into 10.6 2023-05-03 09:51:25 +02:00
item_create.cc Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
item_create.h
item_func.cc Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
item_func.h Merge 10.5 into 10.6 2023-05-23 12:25:39 +03:00
item_geofunc.cc Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
item_geofunc.h
item_jsonfunc.cc Merge 10.5 into 10.6 2023-02-14 15:23:23 +02:00
item_jsonfunc.h Merge 10.5 into 10.6 2023-04-11 16:15:19 +03:00
item_row.cc
item_row.h
item_strfunc.cc Merge 10.5 into 10.6 2023-04-11 16:15:19 +03:00
item_strfunc.h
item_subselect.cc Merge branch '10.5' into 10.6 2023-05-04 11:26:45 +02:00
item_subselect.h Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
item_sum.cc Merge 10.5 into 10.6 2023-04-11 16:15:19 +03:00
item_sum.h Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
item_timefunc.cc
item_timefunc.h
item_vers.cc
item_vers.h
item_windowfunc.cc
item_windowfunc.h
item_xmlfunc.cc
item_xmlfunc.h
json_table.cc
json_table.h
key.cc Merge 10.5 into 10.6 2023-04-11 16:15:19 +03:00
key.h
keycaches.cc
keycaches.h
lex.h
lex_string.h
lex_symbol.h
lock.cc
lock.h
log.cc Merge 10.5 into 10.6 2023-04-27 09:48:27 +03:00
log.h Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
log_event.cc MDEV-29621 part 2 of post-merge fixes in galera 2023-05-03 10:32:29 +03:00
log_event.h Merge 10.5 into 10.6 2023-04-25 13:10:33 +03:00
log_event_client.cc Merge 10.5 into 10.6 2023-03-22 15:54:45 +02:00
log_event_old.cc
log_event_old.h
log_event_server.cc Merge branch '10.5' into 10.6 2023-05-03 09:51:25 +02:00
log_slow.h
main.cc
mariadb.h
mdl.cc Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
mdl.h
mem_root_array.h
message.h
message.mc
message.rc
mf_iocache.cc
mf_iocache_encr.cc
MSG00001.bin
multi_range_read.cc
multi_range_read.h
my_apc.cc
my_apc.h
my_decimal.cc
my_decimal.h
my_json_writer.cc
my_json_writer.h Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
myskel.m4.in
mysql_install_db.cc
mysql_upgrade_service.cc
mysqld.cc Remove warning of not freed memory if mysqld aborts 2023-05-22 18:05:31 +03:00
mysqld.h Merge 10.5 into 10.6 2023-04-11 16:15:19 +03:00
mysqld_suffix.h
net_serv.cc
opt_index_cond_pushdown.cc
opt_range.cc Merge 10.5 into 10.6 2023-04-25 13:10:33 +03:00
opt_range.h
opt_range_mrr.cc
opt_split.cc Merge branch '10.5' into 10.6 2023-05-04 07:36:37 +02:00
opt_subselect.cc Merge 10.5 into 10.6 2023-02-28 16:05:21 +02:00
opt_subselect.h
opt_sum.cc
opt_table_elimination.cc Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
opt_trace.cc
opt_trace.h
opt_trace_context.h
parse_file.cc
parse_file.h Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
partition_element.h
partition_info.cc
partition_info.h
password.c
plistsort.c
privilege.h
procedure.cc
procedure.h
protocol.cc
protocol.h Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
proxy_protocol.cc
proxy_protocol.h
records.cc
records.h
repl_failsafe.cc
repl_failsafe.h
replication.h
rowid_filter.cc
rowid_filter.h Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
rpl_constants.h
rpl_filter.cc
rpl_filter.h
rpl_gtid.cc
rpl_gtid.h
rpl_injector.cc
rpl_injector.h
rpl_mi.cc
rpl_mi.h
rpl_parallel.cc Merge branch '10.5' into 10.6 2023-05-03 09:51:25 +02:00
rpl_parallel.h Merge 10.5 into 10.6 2023-04-11 16:15:19 +03:00
rpl_record.cc
rpl_record.h
rpl_record_old.cc
rpl_record_old.h
rpl_reporting.cc
rpl_reporting.h rpl_reporting: sprintf -> snprintf 2023-03-24 12:04:16 +11:00
rpl_rli.cc Merge 10.5 into 10.6 2023-04-11 16:15:19 +03:00
rpl_rli.h
rpl_tblmap.cc
rpl_tblmap.h
rpl_utility.cc
rpl_utility.h
rpl_utility_server.cc
scheduler.cc
scheduler.h
select_handler.cc Added detection of memory overwrite with multi_malloc 2023-02-27 19:25:44 +02:00
select_handler.h
semisync.cc
semisync.h
semisync_master.cc Merge remote-tracking branch '10.4' into 10.5 2023-03-31 21:32:41 +02:00
semisync_master.h
semisync_master_ack_receiver.cc
semisync_master_ack_receiver.h Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
semisync_slave.cc
semisync_slave.h Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
service_wsrep.cc MDEV-29293 MariaDB stuck on starting commit state 2023-05-22 00:42:05 +02:00
session_tracker.cc
session_tracker.h
set_var.cc
set_var.h
signal_handler.cc Merge 10.5 into 10.6 2023-04-11 16:15:19 +03:00
slave.cc Merge branch '10.5' into 10.6 2023-05-03 09:51:25 +02:00
slave.h Merge branch '10.3' into 10.4 2023-05-02 10:09:27 +02:00
sp.cc
sp.h Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
sp_cache.cc
sp_cache.h
sp_head.cc
sp_head.h Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
sp_pcontext.cc
sp_pcontext.h
sp_rcontext.cc
sp_rcontext.h
spatial.cc
spatial.h Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
sql_acl.cc Merge 10.5 into 10.6 2023-04-11 16:15:19 +03:00
sql_acl.h
sql_acl_getsort.ic
sql_admin.cc
sql_admin.h Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
sql_alloc.h
sql_alter.cc
sql_alter.h Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
sql_analyse.cc
sql_analyse.h
sql_analyze_stmt.cc
sql_analyze_stmt.h MDEV-30972: ANALYZE FORMAT=JSON: some time is unaccounted-for in BNL-H join 2023-04-04 12:18:37 +03:00
sql_array.h
sql_audit.cc
sql_audit.h
sql_base.cc Merge 10.5 into 10.6 2023-04-11 16:15:19 +03:00
sql_base.h Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
sql_basic_types.h
sql_binlog.cc
sql_binlog.h
sql_bitmap.h
sql_bootstrap.cc
sql_bootstrap.h
sql_builtin.cc.in
sql_cache.cc
sql_cache.h
sql_callback.h
sql_class.cc MDEV-29293 MariaDB stuck on starting commit state 2023-05-22 00:42:05 +02:00
sql_class.h MDEV-29293 MariaDB stuck on starting commit state 2023-05-22 00:42:05 +02:00
sql_client.cc
sql_cmd.h
sql_connect.cc
sql_connect.h
sql_const.h
sql_crypt.cc
sql_crypt.h
sql_cte.cc
sql_cte.h
sql_cursor.cc Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
sql_cursor.h
sql_db.cc
sql_db.h
sql_debug.h Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
sql_delete.cc Merge 10.5 into 10.6 2023-04-11 16:15:19 +03:00
sql_delete.h
sql_derived.cc Merge 10.5 into 10.6 2023-04-25 13:10:33 +03:00
sql_derived.h
sql_digest.cc
sql_digest.h
sql_digest_stream.h
sql_do.cc
sql_do.h
sql_error.cc
sql_error.h Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
sql_explain.cc Merge 10.5 into 10.6 2023-04-11 16:15:19 +03:00
sql_explain.h Merge 10.5 into 10.6 2023-04-11 16:15:19 +03:00
sql_expression_cache.cc Added detection of memory overwrite with multi_malloc 2023-02-27 19:25:44 +02:00
sql_expression_cache.h
sql_get_diagnostics.cc
sql_get_diagnostics.h
sql_handler.cc
sql_handler.h
sql_help.cc
sql_help.h
sql_hset.h Whitespace fix 2023-02-15 15:08:16 +02:00
sql_i_s.h
sql_insert.cc Merge branch '10.5' into 10.6 2023-05-04 18:47:11 +02:00
sql_insert.h
sql_join_cache.cc ANALYZE FORMAT=JSON: Backport block-nl-join.r_unpack_time_ms from 11.0 +fix MDEV-30830. 2023-04-04 12:18:29 +03:00
sql_join_cache.h Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
sql_lex.cc Merge branch '10.5' into 10.6 2023-05-03 09:51:25 +02:00
sql_lex.h Merge branch '10.5' into 10.6 2023-05-03 09:51:25 +02:00
sql_lifo_buffer.h
sql_limit.h Merge 10.5 into 10.6 2023-05-23 12:25:39 +03:00
sql_list.cc
sql_list.h
sql_load.cc
sql_load.h
sql_locale.cc MDEV-30630 locale: Chinese error messages for ZH_CN 2023-02-15 22:39:38 +11:00
sql_locale.h
sql_manager.cc
sql_manager.h
sql_mode.cc
sql_mode.h
sql_parse.cc MDEV-29293 MariaDB stuck on starting commit state 2023-05-22 00:42:05 +02:00
sql_parse.h
sql_partition.cc
sql_partition.h
sql_partition_admin.cc
sql_partition_admin.h
sql_plist.h
sql_plugin.cc
sql_plugin.h
sql_plugin_compat.h
sql_plugin_services.inl MDEV-29293 MariaDB stuck on starting commit state 2023-05-22 00:42:05 +02:00
sql_prepare.cc Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
sql_prepare.h
sql_priv.h MDEV-30812: Improve output cardinality estimates for hash join 2023-04-28 16:24:08 +03:00
sql_profile.cc
sql_profile.h
sql_reload.cc
sql_reload.h
sql_rename.cc
sql_rename.h
sql_repl.cc Merge 10.5 into 10.6 2023-04-11 16:15:19 +03:00
sql_repl.h
sql_schema.cc MDEV-31153 New methods Schema::make_item_func_* for REPLACE, SUBSTRING, TRIM 2023-04-29 08:06:46 +04:00
sql_schema.h Merge branch 'bb-10.4-release' into bb-10.5-release 2023-05-02 13:54:54 +02:00
sql_select.cc Merge 10.5 into 10.6 2023-05-23 12:25:39 +03:00
sql_select.h Merge 10.5 into 10.6 2023-05-23 12:25:39 +03:00
sql_sequence.cc Merge branch 'bb-10.4-release' into bb-10.5-release 2023-05-02 13:54:54 +02:00
sql_sequence.h
sql_servers.cc
sql_servers.h
sql_show.cc Merge 10.5 into 10.6 2023-04-11 16:15:19 +03:00
sql_show.h
sql_signal.cc
sql_signal.h
sql_sort.h Merge 10.5 into 10.6 2023-04-11 16:15:19 +03:00
sql_state.c
sql_statistics.cc Merge branch '10.5' into 10.6 2023-05-03 09:51:25 +02:00
sql_statistics.h
sql_string.cc Merge 10.5 into 10.6 2023-04-11 16:15:19 +03:00
sql_string.h Merge 10.5 into 10.6 2023-04-11 16:15:19 +03:00
sql_table.cc Merge 10.5 into 10.6 2023-04-25 13:10:33 +03:00
sql_table.h
sql_tablespace.cc
sql_tablespace.h
sql_test.cc Merge 10.5 into 10.6 2023-03-28 15:25:52 +03:00
sql_test.h
sql_time.cc
sql_time.h
sql_trigger.cc
sql_trigger.h
sql_truncate.cc
sql_truncate.h
sql_tvc.cc Merge 10.5 into 10.6 2023-04-11 16:15:19 +03:00
sql_tvc.h
sql_type.cc Merge 10.5 into 10.6 2023-04-11 16:15:19 +03:00
sql_type.h 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
sql_type_fixedbin.h Merge 10.5 into 10.6 2023-04-11 16:15:19 +03:00
sql_type_fixedbin_storage.h Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
sql_type_geom.cc
sql_type_geom.h
sql_type_int.h
sql_type_json.cc
sql_type_json.h
sql_type_real.h
sql_type_string.cc
sql_type_string.h
sql_udf.cc
sql_udf.h
sql_union.cc Merge 10.5 into 10.6 2023-02-28 16:05:21 +02:00
sql_union.h
sql_update.cc Merge 10.5 into 10.6 2023-04-11 16:15:19 +03:00
sql_update.h
sql_view.cc MDEV-31162 Crash for query using ROWNUM over multi-table view with ORDER BY 2023-05-02 01:05:18 -07:00
sql_view.h
sql_window.cc Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
sql_window.h
sql_yacc.yy Merge branch '10.5' into 10.6 2023-05-03 09:51:25 +02:00
strfunc.cc
strfunc.h
structs.h Merge branch '10.5' into 10.6 2023-05-03 09:51:25 +02:00
sys_vars.cc MDEV-30812: Improve output cardinality estimates for hash join 2023-04-28 16:24:08 +03:00
sys_vars.inl
sys_vars_shared.h
table.cc Merge branch '10.5' into 10.6 2023-05-04 18:47:11 +02:00
table.h Merge 10.5 into 10.6 2023-05-23 12:25:39 +03:00
table_cache.cc
table_cache.h
temporary_tables.cc MDEV-23000: Ensure we get a warning from THD::drop_temporary_table() in case of disk errors 2023-03-09 08:51:00 +11:00
thr_malloc.cc
thr_malloc.h
thread_cache.h
thread_pool_info.cc
threadpool.h Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
threadpool_common.cc
threadpool_generic.cc Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
threadpool_generic.h
threadpool_win.cc
threadpool_winsockets.cc
threadpool_winsockets.h
transaction.cc
transaction.h
tzfile.h
tztime.cc [MDEV-30854] Do not use " as string delimiter in mariadb-tzinfo-to-sql 2023-04-18 16:53:31 +10:00
tztime.h
udf_example.c
udf_example.def
uniques.cc
uniques.h
unireg.cc
unireg.h
upgrade_conf_file.cc
vers_string.h
win_tzname_data.h
winmain.cc
winservice.c
winservice.h
wsrep_applier.cc
wsrep_applier.h
wsrep_binlog.cc
wsrep_binlog.h
wsrep_check_opts.cc
wsrep_client_service.cc Merge 10.5 into 10.6 2023-04-25 13:10:33 +03:00
wsrep_client_service.h
wsrep_client_state.h
wsrep_condition_variable.h
wsrep_dummy.cc MDEV-29293 MariaDB stuck on starting commit state 2023-05-22 00:42:05 +02:00
wsrep_high_priority_service.cc MDEV-29293 MariaDB stuck on starting commit state 2023-05-22 00:42:05 +02:00
wsrep_high_priority_service.h
wsrep_mutex.h
wsrep_mysqld.cc MDEV-29293 MariaDB stuck on starting commit state 2023-05-22 00:42:05 +02:00
wsrep_mysqld.h
wsrep_mysqld_c.h
wsrep_notify.cc
wsrep_on.h
wsrep_plugin.cc
wsrep_priv.h
wsrep_schema.cc Merge branch '10.5' into 10.6 2023-05-03 09:51:25 +02:00
wsrep_schema.h
wsrep_server_service.cc MDEV-29293 MariaDB stuck on starting commit state 2023-05-22 00:42:05 +02:00
wsrep_server_service.h MDEV-29293 MariaDB stuck on starting commit state 2023-05-22 00:42:05 +02:00
wsrep_server_state.cc
wsrep_server_state.h
wsrep_sst.cc
wsrep_sst.h
wsrep_storage_service.cc
wsrep_storage_service.h
wsrep_thd.cc MDEV-29293 MariaDB stuck on starting commit state 2023-05-22 00:42:05 +02:00
wsrep_thd.h MDEV-29293 MariaDB stuck on starting commit state 2023-05-22 00:42:05 +02:00
wsrep_trans_observer.h MDEV-29293 MariaDB stuck on starting commit state 2023-05-22 00:42:05 +02:00
wsrep_types.h
wsrep_utils.cc
wsrep_utils.h
wsrep_var.cc
wsrep_var.h
wsrep_xid.cc
wsrep_xid.h
xa.cc
xa.h